- fix jd test error
This commit is contained in:
@@ -182,14 +182,18 @@ func GenerateGetURL(baseURL, apiStr string, params map[string]interface{}) strin
|
||||
return baseURL + queryString
|
||||
}
|
||||
|
||||
func SendFakeRequest(method, url, body, contentType string) (*http.Response, error) {
|
||||
request, _ := http.NewRequest(method, url, strings.NewReader(body))
|
||||
func BuildRequest(method, url, body, contentType string) (request *http.Request) {
|
||||
request, _ = http.NewRequest(method, url, strings.NewReader(body))
|
||||
if contentType == "" {
|
||||
contentType = "application/x-www-form-urlencoded"
|
||||
}
|
||||
request.Header.Set("Content-Type", contentType)
|
||||
return request
|
||||
}
|
||||
|
||||
func SendFakeRequest(method, url, body, contentType string) (*http.Response, error) {
|
||||
client := &http.Client{}
|
||||
return client.Do(request)
|
||||
return client.Do(BuildRequest(method, url, body, contentType))
|
||||
}
|
||||
|
||||
// 过滤 utf8mb4(比如emoji表情)
|
||||
|
||||
Reference in New Issue
Block a user