Skip to content
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

URL param encoding differs from expected behaviour when using Axios client #39

Open
acardnell-intruder opened this issue Jul 14, 2023 · 0 comments
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified

Comments

@acardnell-intruder
Copy link

acardnell-intruder commented Jul 14, 2023

Description 📖

When using the Axios client, URL query parameters aren't formatting as you'd expect when dealing with objects. As an example, if you were to pass the following to Axios:

const params = { foo: { bar: true } }
axios.get('some-url', { params })

The expected behaviour is that Axios would send a request with the URL formatted as:

https://some-url?foo[bar]=true

However, when using this library, the URL is encoded slightly differently, and looks more like:

http://some-url?foo=%7B%22bar%22:true%7D

I investigated overriding the fetch method and some of the other options, but it seems by the time the configuration reaches those functions the URL has already been formatted.

Given that the library is using Axios.instance.request when using the Axios client, it would be nice if there was a way to pass the params directly into the Axios.instance.request function and let it encode the URL params itself, or at the very least encode the URL params in the same fashion.

Reproduction/Logs 🐞📜

I tested this with a simple path helper that sends a GET request to an endpoint, with a call like the following:

    return await myJsFromRoutes.list({ query: { foo: { bar: true } } })

Let me know if you need any more detail on this.

@acardnell-intruder acardnell-intruder added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified
Projects
None yet
Development

No branches or pull requests

1 participant