hashicorp / hashicorp/go-retryablehttp

Return the body alongside the status in the `baseRetryPolicy` in case of error

Open
#212 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
298
PR merge metrics
No merged PRs in 30d

Description

Presently, when the following case is true inside the `baseRetryPolicy`:

```
if resp.StatusCode == 0 || (resp.StatusCode >= 500 && resp.StatusCode != http.StatusNotImplemented) {
```

the only things returned are the `status` and the `statusCode`, however, in some cases, the server returns more information regarding the error within the response's body.

Adding the `response body` to the error returned by the `baseRetryPolicy` would be helpful for logging and debugging purposes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.