优化插件的参数请求

This commit is contained in:
Yun
2024-01-01 14:10:18 +08:00
parent c7c03ab1d3
commit 5159d5d258
6 changed files with 238 additions and 102 deletions
+6 -7
View File
@@ -9,11 +9,10 @@ import (
)
func TestGet(t *testing.T) {
p := CurlParams{}
p.Url = "http://www.baidu.com"
p.Method = "GET"
resp, code, err := NewCurlx().Send(context.Background(), &p)
resp, code, err := NewCurlx().Send(context.Background(),
SetUrl("https://www.baidu.com"),
SetMethod(MethodGet),
)
t.Log(resp, code, err)
}
@@ -37,7 +36,7 @@ func TestForm(t *testing.T) {
},
}
p := &CurlParams{
p := ClientParams{
Url: "http://tech-dev.sealmoo.com/api/material/upload",
Method: "POST",
Params: s,
@@ -46,6 +45,6 @@ func TestForm(t *testing.T) {
},
ContentType: ContentTypeForm,
}
resp, code, err := NewCurlx().Send(context.Background(), p)
resp, code, err := NewCurlx().Send(context.Background(), SetAll(p))
fmt.Println(resp, code, err)
}