Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### New Features and Improvements

### Bug Fixes
fix: 1243 returns both resetErr and the request's err on retries.Halt

### Documentation

Expand Down
4 changes: 3 additions & 1 deletion httpclient/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ func (c *ApiClient) handleError(ctx context.Context, err error, body common.Requ
return nil, retries.Halt(err)
}
if resetErr := body.Reset(); resetErr != nil {
return nil, retries.Halt(resetErr)
return nil, retries.Halt(
fmt.Errorf("%w, request error: %w", resetErr, err),
)
}
return nil, retries.Continue(err)
}
Expand Down
1 change: 1 addition & 0 deletions httpclient/api_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ func TestCannotRetryArbitraryReader(t *testing.T) {
err := client.Do(context.Background(), "POST", "/a",
WithRequestData(customReader{}))
require.ErrorContains(t, err, "cannot reset reader of type httpclient.customReader")
require.ErrorContains(t, err, "http 429")
}

func TestRetryGetRequest(t *testing.T) {
Expand Down