Skip to content
Advertisement

How can I send a request with Axios to a URL with a query string?

I am trying to upgrade a working piece of code from Axios 0.27.2 to 1.0.0 and the way a URL with a query string is handled seems to break. That is, I get a 404 response and the actual URL used looks different than before in that the question mark is missing.

The URL looks like this: https://my.server.com/some/path?foo=bar&baz=abc Previous axios used that. In the 1.0.0 version the actual URL sent, as reported in the error, is: https://my.server.com/some/pathfoo=bar&baz=abc

Similar questions all revolve around how to build a query string and the fact that axios accepts a params object for that. In my case, I am getting a URL from elsewhere that contains / may contain a query string already. How can I convince Axios to use this URL without changing it in some way?

Advertisement

Answer

See https://github.com/axios/axios/issues/4999

This is a bug in Axios 1.0.0, fixed in 1.1.0

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement