mirror of
https://github.com/mailgun/groupcache.git
synced 2024-11-16 14:10:04 +00:00
Merge pull request #13 from ukai/fix_http
Close body even if it got error http status.
This commit is contained in:
commit
df73e837ff
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