-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
axios.post sends a GET request #1629
Comments
OK just found the solution ! https://stackoverflow.com/questions/47208440/axios-xmlhttprequest-is-sending-get-instead-of-post-in-production-environment this was caused the trailing slash at the end of the request URI, which was causing a 301 redirect. The POST request was not visible in the XHR tab of Chrome's debug console. |
this is quite weird cause I just had the opposite case. my endpoint expects |
Same here, some api routes need tail '/', I just skipped it and it automatically does a GET request |
I am having the same issue today. I have a trailing slash Package version: |
So... is this an issue with the middleware that redirects? Or is this an actual issue with axios? |
With or without a trailing slash, it still sends a GET request. Very frustrating since it causes the request to abort. I am trying to upload a file from a React app to a Django server. Package version: 0.19.0 |
Interesting how there is no answer. Did something break in Axios? |
same here i send the request without "/" at the end of the URL and with POST request, but it changed to Get request automatically "axios": "^0.18",
|
After analyzing the problem, I identified three items that can create strange behavior.
In my case, there was a third situation. I use the i18n plugin. My request:
When prompted, the i18n plugin translated the request with the language in url /en/account/user. After I processed the request on the client side by adding the language to url /en/account/login, the problem went away. I hope this is helpful. |
Summary
This code should send a POST request, but sends a GET request ! It happens only when my app is deployed on my production server. But the bug happens before reaching the back-end so I don't understand what is happening and why it is related to the environment. No problem on my local machine.
Context
The text was updated successfully, but these errors were encountered: