-
Notifications
You must be signed in to change notification settings - Fork 992
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
Request context is lost #457
Comments
Because the |
It works for me: https://go.dev/play/p/Sdjef2JUQ1S . And see also https://go.dev/doc/go1#unexported . I think using |
You have me confused here. I was convinced I had the issue of my context not being copied and fixed it with this change. Your test works and the Go specification clearly states;
I can not reproduce the issue I thought I had, neither when downgrading back to Go1.11. The pointer to the context is always copied. There might be other issues with this shallow clone that using the new |
In
oauth2.Transport.RoundTrip
the given request is cloned so it may be changed (auth header added), as dictated by the Roundtripper-contract. But this clone does not include the request context.This can easily be fixed.
Current versions of Go have a
http.Request.Clone
receiver which clones even more fields, which might serve as inspiration.The text was updated successfully, but these errors were encountered: