While calling the API axios adds an extra '/' in request at the end (not base url)
Describe the bug
Hey, If url contains the text 'post' in the url its observed axios is adding extra '/' at the end while calling the api which results into 404 Not found.
e.g. formed url while calling - https://hostname/users/bhushan.joshi@gmail/EMP/temp-auth-method final url - https://hostname/users/bhushan.joshi@gmail/EMP/temp-auth-method
But when its had 'post' in the url e.g. formed url while calling - https://hostname/users/bhushan.postel@gmail/EMP/temp-auth-method OR https://hostname/users/bhushan.abcpostxx@gmail/EMP/temp-auth-method final url - https://hostname/users/bhushan.postel@gmail/EMP/temp-auth-method**/** (adds extra slash in it)
To Reproduce
No response
Code snippet
const response = await endpoint().put(`users/${userId}/${userType}/temp-auth-method`,
payload,
{ headers: { 'Csrf-Token': 'nocheck' } }
);
Expected behavior
No response
Axios Version
^0.21.1
Adapter Version
No response
Browser
chrome,IE
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
Does this have any impact?
Yes, it breaking API call
can i contribute in this issue
Hello,
I've investigated this issue and my findings suggest that this is not a bug in Axios.
Method: I used an Axios request interceptor to log the exact URL being sent, just before it leaves the client.
Result: The logged URL was correctly formed, even when it contained the word "post". It did not have the extra trailing slash.
Conclusion: This strongly indicates that the extra slash is being added by a server-side redirect (like a 301 or 302 response) after the request is sent. The problem lies in the server's configuration, not the Axios library.
I believe this issue can be closed.