Update client.go to get response header whether there is an error or not. (#751)
Update client.go to get response header whether there is an error or not. Because 429 Too Many Requests error response has "Retry-After" header.
This commit is contained in:
@@ -129,14 +129,14 @@ func (c *Client) sendRequest(req *http.Request, v Response) error {
|
|||||||
|
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
if isFailureStatusCode(res) {
|
|
||||||
return c.handleErrorResp(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
if v != nil {
|
if v != nil {
|
||||||
v.SetHeader(res.Header)
|
v.SetHeader(res.Header)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isFailureStatusCode(res) {
|
||||||
|
return c.handleErrorResp(res)
|
||||||
|
}
|
||||||
|
|
||||||
return decodeResponse(res.Body, v)
|
return decodeResponse(res.Body, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user