diff --git a/response.go b/response.go index 3176aeb..9e2da78 100644 --- a/response.go +++ b/response.go @@ -38,12 +38,14 @@ func FromHTTPResponse(resp *http.Response) (*Response, error) { srcReader := bytes.NewReader(srcbuf) if r, err := gzip.NewReader(srcReader); err == nil { + defer r.Close() buf, err := ioutil.ReadAll(r) if err != nil { panic(err) } content = string(buf) } else if r, err := zlib.NewReader(srcReader); err == nil { + defer r.Close() buf, err := ioutil.ReadAll(r) if err != nil { panic(err) diff --git a/session_test.go b/session_test.go index fc68714..e249136 100644 --- a/session_test.go +++ b/session_test.go @@ -319,7 +319,7 @@ func TestSession_SetConfig(t *testing.T) { func TestSession_SetConfigInsecure(t *testing.T) { ses := NewSession() - ses.SetConfig(CInsecure, false) + ses.SetConfig(CInsecure, true) for _, badSSL := range []string{ "https://self-signed.badssl.com/",