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:
ando-masaki authored and GitHub committed 2024-05-24 11:18:47 +04:00
1 parent 4f4a85687b
commit 211cb49fc2
1 file changed
+4 -4
+4 -4
View File
@@ -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)
} }