Skip to content

Commit

Permalink
Merge pull request #10 from nulab/issue-9/remove-the-code-that-drains…
Browse files Browse the repository at this point in the history
…-the-response-body

remove the code that drains the response body (#9)
  • Loading branch information
vvatanabe authored May 7, 2018
2 parents 7aeceab + a0004ba commit 74a76a4
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions typetalk/internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"reflect"
Expand Down Expand Up @@ -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}

Expand Down

0 comments on commit 74a76a4

Please sign in to comment.