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

Query parameter keys are deep converted to snake_case unexpectedly #46

Open
2 tasks done
marcowindt opened this issue May 22, 2024 · 0 comments
Open
2 tasks done
Labels
bug: pending triage Something doesn't seem to be working, but hasn't been verified

Comments

@marcowindt
Copy link

marcowindt commented May 22, 2024

  • I have tried upgrading by running bundle update js_from_routes.
  • I have read the troubleshooting section before opening an issue.

Description 📖

When doing a request with query parameters, the keys are always case converted to snake_case.
I.e. unless a URLSearchParams object is passed.

const queryStr = isURLSearchParams(params)
? params.toString()
: serializeQuery(deepConvertKeys(params, snakeCase))

Which resulted in a bug in one of our applications.

Work around for now is to pass a URLSearchParams object (or JSON.stringify(value) if possible for you), but can this perhaps be changed to use the default Config.serializeData function or a different config?

Reproduction/Logs 🐞📜

For example when doing

return await myJsFromRoutes.list({ query: { foo: { barOs: [] } } });

Will make a request as follows

path/to/my-route?foo=%7B%bar_os%22:[]%7D

Happy to contribute if agreed upon a solution, thanks!

@marcowindt marcowindt added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label May 22, 2024
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