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

Prevent body from being closed by the Request RoundTripper #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zekroTJA
Copy link
Member

Because the Request RoundTripper closes passed body streams if they implement io.Close, seeking the body on re-trying the request after an authentication error fails because the body stream is already closed.

This implementation prevents the RoudTripper from closing the body so we can postpone the closing until we are done with the body stream.

@chripo
Copy link
Member

chripo commented Jan 28, 2022

i think this could lead to multiple close calls / undefined behavior because we do recursion due to authentication errors.

@chripo
Copy link
Member

chripo commented Jan 28, 2022

#15 is a long thorn in my side :)

@chripo
Copy link
Member

chripo commented Feb 3, 2023

I've made some progress on #15 this will hopefully close this issue too.

@chripo
Copy link
Member

chripo commented Jun 22, 2023

if the issue still present, we could continue on top of master.

@ueffel
Copy link
Collaborator

ueffel commented Oct 18, 2023

btw: there is already io.NopCloser in the stdlib. No need to reinvent it :)

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.

None yet

3 participants