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

arrayFormat equivalent in urijs #389

Open
Noitidart opened this issue Oct 19, 2019 · 1 comment
Open

arrayFormat equivalent in urijs #389

Noitidart opened this issue Oct 19, 2019 · 1 comment
Labels

Comments

@Noitidart
Copy link

Coming from qs we would control how arrays in query parameters would be with the arrayFormat option (quote from qs docs below):

You may use the arrayFormat option to specify the format of the output array:

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'
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' })
// 'a=b,c'

How can we control the format with urijs?

@rodneyrehm
Copy link
Member

There is currently no way to control serialization like that because URI.js only implements the equivalent of repeat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants