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:
1 parent
4f4a85687b
commit
211cb49fc2
1 file changed
+4
-4
@@ -129,14 +129,14 @@ func (c *Client) sendRequest(req *http.Request, v Response) error {
|
||||
|
||||
defer res.Body.Close()
|
||||
|
||||
if isFailureStatusCode(res) {
|
||||
return c.handleErrorResp(res)
|
||||
}
|
||||
|
||||
if v != nil {
|
||||
v.SetHeader(res.Header)
|
||||
}
|
||||
|
||||
if isFailureStatusCode(res) {
|
||||
return c.handleErrorResp(res)
|
||||
}
|
||||
|
||||
return decodeResponse(res.Body, v)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user