HTTPX not flexible enough with preservation of HTTP method for 301 Moved Permanently redirect #2582
Unanswered
aebrahim
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Sadly, the specification for
301is not strict enough, and says that the request method may be changed toGET(source). An external API provider that we call requires that the method be preserved, which is also the behavior used by tools like Postman.I could not find a way to force HTTPX into this behavior. While HTTPX isn't doing anything wrong here per the standard, it would be nice to have an option called
preserve_method_on_301_redirector something to that effect. Another option would be a first-party wrapper to transparently follow redirects for this method, such ashttpx.follow_301_redirects_preserving_method(client, response)which didn't seem as clean to me as an end-user of this library, but might be simpler to implement - I am not sure given that I'm not that familiar with httpx internals.Here is a code block demonstrating our issue
Beta Was this translation helpful? Give feedback.
All reactions