fix: close and drain the response body always (#8847)

This commit is contained in:
Harshavardhana
2020-01-21 02:46:58 -08:00
committed by GitHub
parent 3011692d93
commit e2b3c083aa
9 changed files with 17 additions and 4 deletions

View File

@@ -20,6 +20,8 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
@@ -100,6 +102,7 @@ func (u URL) DialHTTP() error {
if err != nil {
return err
}
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
return nil
}