- fix retry bug (request can not be reused).
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package dadaapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@@ -108,10 +107,11 @@ func (a *API) AccessAPI(action string, params map[string]interface{}) (retVal *R
|
||||
}
|
||||
params2[signKey] = a.signParams(params2)
|
||||
params2Bytes := utils.MustMarshal(params2)
|
||||
request, _ := http.NewRequest("POST", a.url+"/"+action, bytes.NewReader(params2Bytes))
|
||||
request.Header.Set("Content-Type", "application/json")
|
||||
// request, _ := http.NewRequest(http.MethodPost, a.url+"/"+action, bytes.NewReader(params2Bytes))
|
||||
header := make(http.Header)
|
||||
header.Set("Content-Type", "application/json")
|
||||
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client, request, a.config, func(response *http.Response) (result string, err error) {
|
||||
err = platformapi.AccessPlatformAPIWithRetry(a.client, http.MethodPost, a.url+"/"+action, string(params2Bytes), header, a.config, func(response *http.Response) (result string, err error) {
|
||||
jsonResult1, err := utils.HTTPResponse2Json(response)
|
||||
if err != nil {
|
||||
return platformapi.ErrLevelGeneralFail, err
|
||||
|
||||
Reference in New Issue
Block a user