- fix jd test error

This commit is contained in:
gazebo
2019-05-09 09:52:55 +08:00
parent 89b285da53
commit a3aad5b126
3 changed files with 13 additions and 9 deletions

View File

@@ -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表情