Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GetBody in hijack LoadResponse request for http2 retry #1128

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pyneda
Copy link

@pyneda pyneda commented Oct 19, 2024

Fix for the following error

(http2: Transport: cannot retry err [stream error: stream ID 1; PROTOCOL_ERROR; received from peer] after Request.Body was written; define Request.GetBody to avoid this error)

Copy link
Member

@ysmood ysmood left a comment

Choose a reason for hiding this comment

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

Could you add at least a test for it?

@pyneda
Copy link
Author

pyneda commented Oct 21, 2024

Could you add at least a test for it?

Attempted to set up a test case using an HTTP/2 test server and a client that forces retries to reproduce the original issue. However, I wasn't able to replicate the same error within a test case.

As a fallback, added a simpler test that ensures the request body is correctly propagated through redirects and verifies that the GetBody function added in LoadResponse behaves as expected.

Some related issues:
stripe/stripe-go#710
connectrpc/connect-go#541

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.

2 participants