From e85183c247a310f0053dafd0985956645577e30c Mon Sep 17 00:00:00 2001 From: Will Norris Date: Thu, 31 Mar 2016 20:16:25 +0000 Subject: [PATCH] limit draining up to 512 bytes from response.Body Updates #317 --- github/github.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() }()