1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-11 00:02:28 +08:00

fix: sending post request with header multipart/form-data support query string type is map[string]string

This commit is contained in:
dudaodong
2022-07-07 10:23:15 +08:00
parent 3625921912
commit 3dbd7d8980
3 changed files with 24 additions and 13 deletions

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"io/ioutil"
"log"
"net/url"
"testing"
"github.com/duke-git/lancet/v2/internal"
@@ -57,9 +56,13 @@ func TestHttpPostFormData(t *testing.T) {
UserId int `json:"userId"`
Title string `json:"title"`
}
postData := url.Values{}
postData.Add("userId", "1")
postData.Add("title", "TestAddToDo")
// postData := url.Values{}
// postData.Add("userId", "1")
// postData.Add("title", "TestAddToDo")
postData := make(map[string]string)
postData["userId"] = "1"
postData["title"] = "title"
resp, err := HttpPost(apiUrl, header, postData, nil)
if err != nil {