diff --git a/github/github.go b/github/github.go index e11d579..0c2a8db 100644 --- a/github/github.go +++ b/github/github.go @@ -337,8 +337,8 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { } defer func() { - // Drain and close the body to let the Transport reuse the connection - io.Copy(ioutil.Discard, resp.Body) + // 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() }()