mirror of
https://github.com/mailgun/groupcache.git
synced 2024-07-01 02:19:12 +00:00
Close body even if it got error http status.
Otherwise, http connections keep open if server returned error status (e.g. Get returned error).
This commit is contained in:
parent
61c957aaf8
commit
38eed8b4ba
2
http.go
2
http.go
|
@ -174,10 +174,10 @@ func (h *httpGetter) Get(context Context, in *pb.GetRequest, out *pb.GetResponse
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("server returned: %v", res.Status)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
// TODO: avoid this garbage.
|
||||
b, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user