From a0004ba19e3454874d2ea2c0560a83e8035f2598 Mon Sep 17 00:00:00 2001 From: "yuichi.watanabe" Date: Mon, 7 May 2018 23:55:01 +0900 Subject: [PATCH] remove the code that drains the response body (#9) --- typetalk/internal/internal.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/typetalk/internal/internal.go b/typetalk/internal/internal.go index 6a1a507..5aec1b5 100644 --- a/typetalk/internal/internal.go +++ b/typetalk/internal/internal.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "reflect" @@ -111,12 +110,7 @@ func (c *ClientCore) Do(ctx context.Context, req *http.Request, v interface{}) ( return nil, err } - defer func() { - // Drain up to 512 bytes and close the body to let the Transport reuse the connection - // refs: https://github.com/google/go-github/pull/317 - io.CopyN(ioutil.Discard, resp.Body, 512) - resp.Body.Close() - }() + defer resp.Body.Close() response := &shared.Response{Response: resp}