Skip to content

Commit 211cb49

Browse files
authored
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.
1 parent 4f4a856 commit 211cb49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ func (c *Client) sendRequest(req *http.Request, v Response) error {
129129

130130
defer res.Body.Close()
131131

132-
if isFailureStatusCode(res) {
133-
return c.handleErrorResp(res)
134-
}
135-
136132
if v != nil {
137133
v.SetHeader(res.Header)
138134
}
139135

136+
if isFailureStatusCode(res) {
137+
return c.handleErrorResp(res)
138+
}
139+
140140
return decodeResponse(res.Body, v)
141141
}
142142

0 commit comments

Comments
 (0)