From fa1e7e4cccac5c5cd5906121e48ce53681cfb8fd Mon Sep 17 00:00:00 2001 From: dorlolo <428192774@qq.com> Date: Thu, 24 Mar 2022 22:53:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3formdata=E8=AF=B7=C3=A6=C2=A0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=AF=B7=E6=B1=82=E4=B8=8D=E5=88=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E9=97=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/data_test.go | 23 ----------------------- test/simpleRequest_test.go | 5 +++-- 2 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 test/data_test.go diff --git a/test/data_test.go b/test/data_test.go deleted file mode 100644 index 1695dd7..0000000 --- a/test/data_test.go +++ /dev/null @@ -1,23 +0,0 @@ -/* - * @FileName: dataTest.go - * @Author: JuneXu - * @CreateTime: 2022/3/24 下午9:18 - * @Description: - */ - -package test - -import ( - "encoding/json" - "testing" -) - -func TestData(t *testing.T) { - type dt map[string][]string - var newData = dt{ - "aa": []string{"aa", "cc"}, - } - res, err := json.Marshal(&newData) - t.Log(err) - t.Log(res) -} diff --git a/test/simpleRequest_test.go b/test/simpleRequest_test.go index 32ce881..5286e1d 100644 --- a/test/simpleRequest_test.go +++ b/test/simpleRequest_test.go @@ -49,7 +49,8 @@ func TestRequest(t *testing.T) { } -func TestAuth(t *testing.T) { +//测试content-type 为 multipart/form-data格式的数据请求 +func TestAuth_fotmData(t *testing.T) { req := simpleRequest.NewRequest() req.Headers().ConentType_formData() req.Headers().SetRandomUerAgent() @@ -60,7 +61,7 @@ func TestAuth(t *testing.T) { req.Body().Set("username", "shiming_zyf") req.Body().Set("password", "zyf499bbcb9") - var URL = "https://shiming.cn-jzs.com/oauth/token" + var URL = "" data, _ := req.Post(URL) t.Log(string(data))