POST request magically transformed to GET request when POST endpoint is redirected
See original GitHub issueMy steps:
- Do
axios.post(...)
tohttp://example.com/api/post_endpoint
- server responds 301 with
http*s*://example.com/api/post_endpoint
location - axios sends
GET
(!) request after redirection
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
My request is redirected to a GET request - Postman
To do this, open the Settings tab of your request and toggle off the Automatically follow redirects option. Force your request to follow...
Read more >Why doesn't HTTP have POST redirect?
In HTTP 1.1, there actually is a status code (307) which indicates that the request should be repeated using the same method and...
Read more >transform Post request using the Post-Redirect-Get pattern in ...
While debugging, using this code it comes into the POST request and redirect to the form but it doesn't enter in the GET...
Read more >How to retrieve custom headers, query and URI parameters ...
In the tutorial below, we are going to highlight how to retrieve custom headers, queries, and URI parameters from your HTTP request using...
Read more >Requestly - Lightweight Proxy to Intercept & Modify HTTP(s ...
Requestly allows you to Intercept & Modify network requests. Main features include Mocking APIs Response, Modifying headers, Setting up redirects, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you have been warned:
Note that @makc above cites the obsolete version of the HTTP 1.1 spec, RFC2616. The paragraph right before the highlighted one states that the user agent MUST NOT automatically redirect unless confirmed by the user, which is thus what libraries are obliged to follow for HTTP 1.1 compatibility.
The latest version, RFC7231, states that:
—https://tools.ietf.org/html/rfc7231#section-6.4
—https://tools.ietf.org/html/rfc7231#section-6.4.2
That spec text is cited in the source code referred to above.