Skip to content

Commit

Permalink
Update client.go to get response header whether there is an error or …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ando-masaki committed May 24, 2024
1 parent 4f4a856 commit 211cb49
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 211cb49

Please sign in to comment.