Skip to content

fix: preserve HTTP response body after retries - #1272

Open
officialasishkumar wants to merge 1 commit into
cloudevents:mainfrom
officialasishkumar:1238-preserve-http-response-body-on-retry
Open

fix: preserve HTTP response body after retries#1272
officialasishkumar wants to merge 1 commit into
cloudevents:mainfrom
officialasishkumar:1238-preserve-http-response-body-on-retry

Conversation

@officialasishkumar

Copy link
Copy Markdown

Fixes: #1238

Summary

  • add RetriesResult.Unwrap() so wrapped HTTP results remain discoverable through standard error traversal
  • add regression coverage for unwrapping retries to *http.Result
  • add a retry-path Send() test that checks the final response body is preserved

Testing

  • go test ./protocol/http

Signed-off-by: Yash Khare <khareyash05@gmail.com>
@officialasishkumar
officialasishkumar requested a review from a team as a code owner April 9, 2026 16:51
@officialasishkumar
officialasishkumar force-pushed the 1238-preserve-http-response-body-on-retry branch from 97aaa59 to 85a35eb Compare April 9, 2026 17:04
@embano1

embano1 commented Apr 27, 2026

Copy link
Copy Markdown
Member

@officialasishkumar needs rebase and signed-off commits.

@kunalworldwide kunalworldwide left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Unwrap() to RetriesResult fixes the error-traversal issue without breaking the existing API. The test shows that protocol.ResultAs(err, &result) now works after retries, which is the real-world use case from #1238.

Preserving the final response body in the retry path is also handled — the test confirms the body can still be read after Send returns. This avoids the common pitfall where wrapping a result and then retrying loses the original HTTP response for callers.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP protocol doesn't return body response when retrying

3 participants