Skip to content

Commit

Permalink
Remove unnecessary closing the body for conn reuse
Browse files Browse the repository at this point in the history
The behavior on connection reuse is introduced in golang/go@18072ad.

Fixes #843
  • Loading branch information
diorahman committed Feb 7, 2018
1 parent 08e68b5 commit 8ec7331
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,6 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
return nil, err
}

defer func() {
// Drain up to 512 bytes and close the body to let the Transport reuse the connection
io.CopyN(ioutil.Discard, resp.Body, 512)
resp.Body.Close()
}()

response := newResponse(resp)

c.rateMu.Lock()
Expand Down

0 comments on commit 8ec7331

Please sign in to comment.