Request method changed on redirect
See original GitHub issueHi,
I’m using axios v0.17.0 with HEAD method like this:
axios.head('http://example.com');
(let’s suppose http://example.com is set to redirect 301 to http://www.example.com)
For some reason Request method will change on the first redirect to GET instead of keeping HEAD all the way down. This will read in logs like this:
example.com:80 10.0.0.1 - - "HEAD / HTTP/1.1" 301 237 "-" "axios/0.17.0"
example.com:80 10.0.0.1 - - "GET / HTTP/1.1" 200 246 "-" "axios/0.17.0"
instead of this:
example.com:80 10.0.0.1 - - "HEAD / HTTP/1.1" 301 237 "-" "axios/0.17.0"
example.com:80 10.0.0.1 - - "HEAD / HTTP/1.1" 200 246 "-" "axios/0.17.0"
When I do the test in Firefox it keeps original request method (HEAD) all the way down.
Any idea why is this?
Thanks, Milos
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Redirections in HTTP - MDN Web Docs - Mozilla
URL redirection, also known as URL forwarding, is a technique to give more than one URL address to a page, a form, or...
Read more >Retain http method on redirect - Stack Overflow
I.e. /user should be redirected too /en/user . This works fine for most request unless the method is POST and there is no...
Read more >Request method POST gets changed to GET after redirect
The command HTTP::redirect sends an HTTP 302 response code which changes the HTTP method in the next request to GET. Recommended Actions.
Read more >Redirect 302 changes method from POST to GET #138 - GitHub
I'm having some problems when following https redirects with wreck. I have this code: server.ext('onRequest', function (request, ...
Read more >HTTP method changed in IS after receiving HTTP 301 Redirect
Hi, We are consuming a REST API from Salesforce and made a HTTP PATCH call from the Integration Server to Salesforce.
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 Free
Top 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
It turns out that olalonde/follow-redirects package is following RFC specifications which says that Request method is case-sensitive as pointed out by @RubenVerborg here but axios is passing lowecase verb
head
causing the wrong redirect behavior.If your PR has a test case for this I am happy to review it 😃