Skip to content

Commit 2f5b584

Browse files
diorahmangmlewis
authored andcommitted
Remove unnecessary draining the resp.Body (#847)
Fixes #843.
1 parent 74e913d commit 2f5b584

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
@@ -477,12 +477,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res
477477

478478
return nil, err
479479
}
480-
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-
}()
480+
defer resp.Body.Close()
486481

487482
response := newResponse(resp)
488483

0 commit comments

Comments
 (0)