Skip to content

Commit 0f8848e

Browse files
committed
Remove unnecessary drain resp.Body
The behavior on connection reuse without manually draining resp.Body is introduced in golang/go@18072ad. Fixes google#843
1 parent 08e68b5 commit 0f8848e

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎github/github.go‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
478478
return nil, err
479479
}
480480

481-
defer func() {
482-
// Drain up to 512 bytes and close the body to let the Transport reuse the connection
483-
io.CopyN(ioutil.Discard, resp.Body, 512)
484-
resp.Body.Close()
485-
}()
486-
481+
resp.Body.Close()
487482
response := newResponse(resp)
488483

489484
c.rateMu.Lock()

0 commit comments

Comments
 (0)