Skip to content

Commit 98bde28

Browse files
committed
Don't close idle connections when request body cannot be obtained
It's an unrelated error, no point in closing keep-alive connections.
1 parent 7e1be79 commit 98bde28

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
564564
if req.body != nil {
565565
body, err := req.body()
566566
if err != nil {
567-
c.HTTPClient.CloseIdleConnections()
568-
return resp, err
567+
return nil, err
569568
}
570569
if c, ok := body.(io.ReadCloser); ok {
571570
req.Body = c

0 commit comments

Comments
 (0)