diff --git a/github/github.go b/github/github.go index 66add82..e11d579 100644 --- a/github/github.go +++ b/github/github.go @@ -336,7 +336,11 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { return nil, err } - defer resp.Body.Close() + defer func() { + // Drain and close the body to let the Transport reuse the connection + io.Copy(ioutil.Discard, resp.Body) + resp.Body.Close() + }() response := newResponse(resp)