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

fix: fix lint issue

This commit is contained in:
dudaodong
2022-12-10 16:53:41 +08:00
parent 13bbe19ab2
commit 1197e8d1b6
6 changed files with 30 additions and 29 deletions

View File

@@ -6,7 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"reflect"
@@ -181,7 +181,7 @@ func (client *HttpClient) setQueryParam(req *http.Request, reqUrl string, queryP
func (client *HttpClient) setFormData(req *http.Request, values url.Values) {
formData := []byte(values.Encode())
req.Body = ioutil.NopCloser(bytes.NewReader(formData))
req.Body = io.NopCloser(bytes.NewReader(formData))
req.ContentLength = int64(len(formData))
}

View File

@@ -1,7 +1,7 @@
package netutil
import (
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
@@ -61,7 +61,7 @@ func TestHttpClent_Post(t *testing.T) {
log.Fatal(err)
}
body, _ := ioutil.ReadAll(resp.Body)
body, _ := io.ReadAll(resp.Body)
t.Log("response: ", resp.StatusCode, string(body))
}
@@ -93,6 +93,6 @@ func TestStructToUrlValues(t *testing.T) {
log.Fatal(err)
}
body, _ := ioutil.ReadAll(resp.Body)
body, _ := io.ReadAll(resp.Body)
t.Log("response: ", string(body))
}

View File

@@ -51,10 +51,7 @@ func TestHttpPostFormData(t *testing.T) {
// "Content-Type": "application/x-www-form-urlencoded",
"Content-Type": "multipart/form-data",
}
type Todo struct {
UserId int `json:"userId"`
Title string `json:"title"`
}
postData := url.Values{}
postData.Add("userId", "1")
postData.Add("title", "TestToDo")