-
Notifications
You must be signed in to change notification settings - Fork 233
auth: clone the client request body before roundtripping #597
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
Conversation
a1fbc37 to
d412e55
Compare
|
Staticcheck failures are being addressed in #599. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this was a bit more complicated than I had thought.
RoundTrippers may read and close the body, so be careful to clone before roundtripping during client oauth, as the request may be issued multiple times. Fixes modelcontextprotocol#590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I had to rebase and squash in order to pick up the CI fixes.
auth/client_test.go
Outdated
| client := &http.Client{Transport: transport} | ||
|
|
||
| resp, err := client.Post(authServer.URL, "application/json", &basicReader{strings.NewReader("{}")}) | ||
| // resp, err := client.Post(authServer.URL, "application/json", strings.NewReader("{}")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cruft.
RoundTrippers may read and close the body, so be careful to clone before roundtripping during client oauth, as the request may be issued multiple times.
Fixes #590