解决formdata请æ 格式请求不到数据的问问题
This commit is contained in:
parent
9ea74e0a8a
commit
fa1e7e4ccc
@ -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)
|
|
||||||
}
|
|
@ -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 := simpleRequest.NewRequest()
|
||||||
req.Headers().ConentType_formData()
|
req.Headers().ConentType_formData()
|
||||||
req.Headers().SetRandomUerAgent()
|
req.Headers().SetRandomUerAgent()
|
||||||
@ -60,7 +61,7 @@ func TestAuth(t *testing.T) {
|
|||||||
req.Body().Set("username", "shiming_zyf")
|
req.Body().Set("username", "shiming_zyf")
|
||||||
req.Body().Set("password", "zyf499bbcb9")
|
req.Body().Set("password", "zyf499bbcb9")
|
||||||
|
|
||||||
var URL = "https://shiming.cn-jzs.com/oauth/token"
|
var URL = ""
|
||||||
|
|
||||||
data, _ := req.Post(URL)
|
data, _ := req.Post(URL)
|
||||||
t.Log(string(data))
|
t.Log(string(data))
|
||||||
|
Loading…
Reference in New Issue
Block a user