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

fix(utils): Support arrays & nested objects in query params #148

Merged
merged 4 commits into from
Dec 13, 2018

Conversation

offirgolan
Copy link
Collaborator

@offirgolan offirgolan commented Dec 12, 2018

Resolves #147.

Adds support for parsing arrays and nested objects in querystrings. To preserve the original querystring structure, I've added logic to determine the original array format used (if any).

The used qs library provides an option to specify the arrayFormat when stringifying:

qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' })
// 'a[0]=b&a[1]=c'
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' })
// 'a[]=b&a[]=c'
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' })
// 'a=b&a=c'

@offirgolan offirgolan added bug 🐞 Something isn't working 📦 core labels Dec 12, 2018
@offirgolan offirgolan changed the title fix(core): Support arrays & nested objects in query params fix(utils): Support arrays & nested objects in query params Dec 12, 2018
@offirgolan
Copy link
Collaborator Author

Tests are failing in Node 10 in CI that are unrelated to this change since it fails on master as well. Im gonna go ahead and merge.

@offirgolan offirgolan merged commit 7e846b0 into master Dec 13, 2018
@offirgolan offirgolan deleted the query-param-array-parse branch December 13, 2018 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working 📦 utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants