Skip to content

Commit

Permalink
Don't close idle connections when request body cannot be obtained
Browse files Browse the repository at this point in the history
It's an unrelated error, no point in closing keep-alive connections.
  • Loading branch information
ash2k committed Sep 21, 2021
1 parent 7e1be79 commit 98bde28
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
if req.body != nil {
body, err := req.body()
if err != nil {
c.HTTPClient.CloseIdleConnections()
return resp, err
return nil, err
}
if c, ok := body.(io.ReadCloser); ok {
req.Body = c
Expand Down

0 comments on commit 98bde28

Please sign in to comment.