-
Notifications
You must be signed in to change notification settings - Fork 482
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
Redirect changes HTTP method to GET #1719
Comments
Hi @Lythenas thank you for the issue, I wasn't aware of it, I was thinking that a redirection always switch to a GET.
And in the curl man:
There are also You're welcome to contribute if you want (there is a CONTRIBUTING.md guide). In any case, the issue is in our backlog! |
Just dumping information here for later use: According to the source code I found, Flask will use a 308 (https://github.com/pallets/werkzeug/blob/4048509fb24196df67f944a24aaa4ce1afcba92f/src/werkzeug/routing/exceptions.py#L34) so implementing what curl does would be fine for me. This is the official HTTP standard: https://datatracker.ietf.org/doc/html/rfc9110#name-301-moved-permanently
Similar for 302, 303 is meant to always redirect to GET or HEAD. Implementing the same behavior as curl is probably the best approach. And with the flags the user can then choose to do what they want anyway. I would maybe be inclined to add an additional flag (not sure what to call it, maybe |
What is the current bug behavior?
When using
hurl --location
and there is a redirect on a POST request it will run the (redirected) request as a GET. I suspect this is the same for all HTTP methods, but I haven't checked.Steps to reproduce
/x
to/x/
. This is the default for Flask (unsure if it can be changed easily).echo POST https://localhost/x > test.hurl
hurl --location --verbose test.hurl
https://localhost/x/
and executed as a GET requestWhat is the expected correct behavior?
The redirected request should use the same HTTP method as the original request.
Execution context
hurl --version
): hurl 4.0.0Possible fixes
If it is desired to change the behavior I can look into making a PR.
The text was updated successfully, but these errors were encountered: