Skip to content

Commit

Permalink
Avoid err been override when response middleware is set
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Jan 30, 2023
1 parent 2febcc7 commit b064bf0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1382,8 +1382,9 @@ func (c *Client) roundTrip(r *Request) (resp *Response, err error) {
}

for _, f := range r.client.afterResponse {
if err = f(r.client, resp); err != nil {
resp.Err = err
if e := f(r.client, resp); e != nil {
err = e
resp.Err = e
return
}
}
Expand Down

0 comments on commit b064bf0

Please sign in to comment.