Skip to content

How does axios determin the url? #5567

Answered by agreedSkiing
agreedSkiing asked this question in Q&A
Discussion options

You must be logged in to vote

So since axios becomes XMLHttpRequests on the client machine it uses the default behavior of javascript which makes all requests starting with /api start at the base address of the homepage e.g

Request sent from https://axios-http.com/docs/intro with the path /api/test is transformed to https://axios-http.com/api/test

Any request made with api/ uses the current homepage address path execept current page e.g

Request sent from https://axios-http.com/docs/intro with the path api/test is transformed to https://axios-http.com/docs/api/test

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by agreedSkiing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant