gojek / heimdall

An enhanced HTTP client for Go
http://gojek.tech
Apache License 2.0
2.63k stars 214 forks source link

Response body is not closed after retries, and possibly after a 5xx error #45

Closed sohamkamani closed 6 years ago

sohamkamani commented 6 years ago
  1. For the client as well as the hystrix client, the response body is not closed before the next retry.
  2. If the HTTP status code is >= 500, the client returns an error. This may lead developers to not close the response body on their end.

(1) is pretty straightforward to fix (close the body before the next retry)

For (2) we need to decide whether to send an error for 5xx http status codes. If we decide to omit the error, this would lead to a change in contract, and we would potentially have to bump the major version

rShetty commented 6 years ago

@sohamkamani Thanks for the PR on this issue. Have merged it.

For 2, can't we close the response body within the client, like if err is present so close it ?