-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
BaseURL not being used #1470
Comments
Please, IGNORE THIS ISSUE. Found the problem: I was setting |
Funny enough, that was my problem too. I just realize the mistake after your comment, thank you Mister @tiarebalbi , you were very useful ahahahahahaha |
Im sure this as been changed, I just copied some old code with baseUrl that was working fine and now doesn't work in a more recent project... Ah well. |
Lifesaver, thanks ! |
Thank you very much! This was the exact same problem for me as well. Google search "axios baseurl not working" was totally worth it :D |
Same problem here... thanks! |
dear God, same problem here hahahaha, camelCase sucks |
How can so many people make the same mistake? I've been looking for over an hour now ^^ |
Using |
When I log the instance I'm getting: defaults: {
headers: {
common: [Object],
delete: {},
get: {},
head: {},
post: [Object],
put: [Object],
patch: [Object],
'Content-Type': 'application/json; charset=utf-8'
},
baseURL: 'http://localhost:3000',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 1000,
adapter: [Function: xhrAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus]
} For the config. |
well, probably there could be an alias of |
@kemicofa Can you also post an example of the request or even better create a small codepen? |
Had the same problem. :P |
Summary
I'm having a problem with the defaults property. When an instance is created I'm setting the baseUrl, checking the defaults value I can see that the baseUrl has been set but once I try to send a single request axios is not using the baseUrl set previously.
Code used to request
Note in the end of the response:
_currentUrl: 'http:/users?page=2'
If I change the get method to have the full URL the request works.Response
Context
The text was updated successfully, but these errors were encountered: