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

Got's methodRewriting option differs from request's default behavior and isn't documented in the migration guide #1602

Closed
1 task done
danshick opened this issue Feb 10, 2021 · 0 comments

Comments

@danshick
Copy link

danshick commented Feb 10, 2021

Describe the bug

got defaults to preserving the method verb when following redirects (e.g. a POST with a redirect issues another POST) as described in the README. request did the opposite, choosing to rewrite 301 and 302 to GET by default. This is not documented in the migration guide.

Edit:
I didn't realize that this was already mostly covered by #1307. Ignoring the rest of the suggestion here, I would mention it in the migration guide now before a fix is introduced in got 12.

request's behavior actually follows the spec more closely in this regard. As I read it, rewriting implies changing the verb from the original, not retaining it.

From the RFC:

> Early user agents split on whether the method applied to the redirect target would be the same as the original request [the former semantics] or would be rewritten as GET [the latter semantics].
> ...
> prevailing practice gradually converged on the latter semantics for 301 and 302 as well.
> ...
> Over 10 years later, most user agents still do method rewriting for 301 and 302; therefore, this specification makes that behavior conformant when the original request is POST.

As changing got's default would be a breaking change, correcting the documentation both in the migration guide as well as the README is probably best.

Checklist

  • I have read the documentation.
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

No branches or pull requests

2 participants