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)
|
srcReader := bytes.NewReader(srcbuf)
|
||||||
|
|
||||||
if r, err := gzip.NewReader(srcReader); err == nil {
|
if r, err := gzip.NewReader(srcReader); err == nil {
|
||||||
|
defer r.Close()
|
||||||
buf, err := ioutil.ReadAll(r)
|
buf, err := ioutil.ReadAll(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
content = string(buf)
|
content = string(buf)
|
||||||
} else if r, err := zlib.NewReader(srcReader); err == nil {
|
} else if r, err := zlib.NewReader(srcReader); err == nil {
|
||||||
|
defer r.Close()
|
||||||
buf, err := ioutil.ReadAll(r)
|
buf, err := ioutil.ReadAll(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
@ -319,7 +319,7 @@ func TestSession_SetConfig(t *testing.T) {
|
||||||
func TestSession_SetConfigInsecure(t *testing.T) {
|
func TestSession_SetConfigInsecure(t *testing.T) {
|
||||||
|
|
||||||
ses := NewSession()
|
ses := NewSession()
|
||||||
ses.SetConfig(CInsecure, false)
|
ses.SetConfig(CInsecure, true)
|
||||||
|
|
||||||
for _, badSSL := range []string{
|
for _, badSSL := range []string{
|
||||||
"https://self-signed.badssl.com/",
|
"https://self-signed.badssl.com/",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user