- 修改AccessPlatformAPIWithRetry接口,允许处理返回结果为非JSON请求

This commit is contained in:
gazebo
2019-07-11 15:47:37 +08:00
parent 91a789d1d1
commit 989cd7e618
18 changed files with 98 additions and 31 deletions

View File

@@ -159,7 +159,10 @@ func (a *API) AccessAPI(action string, params map[string]interface{}) (retVal *R
return request
},
a.config,
func(response *http.Response, jsonResult1 map[string]interface{}) (result string, err error) {
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
if jsonResult1 == nil {
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
}
resultError, _ := jsonResult1["error"].(map[string]interface{})
retVal = &ResponseResult{
ID: jsonResult1["id"].(string),
@@ -216,7 +219,10 @@ func (a *API) AcccessAPI2(baseURL string, params map[string]interface{}, method
return request
},
a.config,
func(response *http.Response, jsonResult1 map[string]interface{}) (result string, err error) {
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
if jsonResult1 == nil {
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
}
retVal = jsonResult1
return platformapi.ErrLevelSuccess, nil
})