add close Reader
This commit is contained in:
parent
72491204d6
commit
16859fc78e
|
@ -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)
|
||||
|
|
|
@ -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/",
|
||||
|
|
Loading…
Reference in New Issue
Block a user