- fix retry bug (request can not be reused).
This commit is contained in:
@@ -143,9 +143,9 @@ func (a *API) AccessAPI(apiStr string, jdParams map[string]interface{}) (retVal
|
||||
params["timestamp"] = utils.GetCurTimeStr()
|
||||
sign := a.signParams(params)
|
||||
params[signKey] = sign
|
||||
request, _ := http.NewRequest(http.MethodGet, utils.GenerateGetURL(prodURL, apiStr, params), nil)
|
||||
// request, _ := http.NewRequest(http.MethodGet, utils.GenerateGetURL(prodURL, apiStr, params), nil)
|
||||
//request.Close = true //todo 为了性能考虑
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client, request, a.config, func(response *http.Response) (errLevel string, err error) {
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client, http.MethodGet, utils.GenerateGetURL(prodURL, apiStr, params), "", nil, a.config, func(response *http.Response) (errLevel string, err error) {
|
||||
jsonResult1, err := utils.HTTPResponse2Json(response)
|
||||
if err != nil {
|
||||
return platformapi.ErrLevelGeneralFail, platformapi.ErrResponseDataFormatWrong
|
||||
|
||||
@@ -225,7 +225,7 @@ func TestCallbackMsgPlayback(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, v := range playbackData {
|
||||
_, err := utils.SendFakeRequest("POST", v[1], v[0], "")
|
||||
_, err := utils.SendFakeRequest(http.MethodPost, v[1], v[0], "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user