增加响应结果 -> receiver的解析
This commit is contained in:
parent
fdbec81b1c
commit
62d3c792ce
@ -43,6 +43,7 @@ func (hc *httpClient) Send(requestURL string, method string, header map[string]s
|
||||
err error
|
||||
response *httpclient.Response
|
||||
c *httpclient.HttpClient
|
||||
responseData []byte
|
||||
)
|
||||
if nil == param {
|
||||
param = make(map[string]interface{})
|
||||
@ -64,7 +65,17 @@ func (hc *httpClient) Send(requestURL string, method string, header map[string]s
|
||||
return nil, fmt.Errorf("%v : %v", response.StatusCode, response.Status)
|
||||
}
|
||||
|
||||
return hc.getResponseBody(response)
|
||||
if responseData, err = hc.getResponseBody(response); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if nil == receiver {
|
||||
return responseData, nil
|
||||
}
|
||||
if err = json.Unmarshal(responseData, receiver); nil != err {
|
||||
return responseData, err
|
||||
}
|
||||
return responseData, err
|
||||
}
|
||||
|
||||
// getResponseBody ...
|
||||
|
Loading…
Reference in New Issue
Block a user