mirror of
https://github.com/mailgun/groupcache.git
synced 2024-11-16 14:10:04 +00:00
Merge pull request #46 from MarnixBouhuis/add-peer-error-message-to-error
Add HTTP error message from peer to error returned from httpGetter.Get
This commit is contained in:
commit
abdfdfbb8e
3
http.go
3
http.go
@ -299,7 +299,8 @@ func (h *httpGetter) Get(ctx context.Context, in *pb.GetRequest, out *pb.GetResp
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("server returned: %v", res.Status)
|
||||
msg, _ := ioutil.ReadAll(io.LimitReader(res.Body, 10*1024*1024)) // Limit reading the error body to max 10 MiB
|
||||
return fmt.Errorf("server returned: %v, %v", res.Status, msg)
|
||||
}
|
||||
b := bufferPool.Get().(*bytes.Buffer)
|
||||
b.Reset()
|
||||
|
Loading…
Reference in New Issue
Block a user