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

Incorrect handling of arrays? #66

Closed
Anahkiasen opened this issue Jun 10, 2016 · 6 comments
Closed

Incorrect handling of arrays? #66

Anahkiasen opened this issue Jun 10, 2016 · 6 comments

Comments

@Anahkiasen
Copy link

Anahkiasen commented Jun 10, 2016

Currently if query-string encounters an array it encodes it without brackets:

> require('query-string').stringify({foo: ['bar', 'baz']})
'foo=bar&foo=baz'

However that seems to go against the default browser behavior or one of other languages such as PHP. Shouldn't it be foo[]=bar&foo[]=baz?

I know this is kind of a grey area of the RFC but that struck me as odd, is this intended?

@SamVerschueren
Copy link
Contributor

I believe this is intended. All node frameworks handle it correctly.

@abdulrahmancz
Copy link

What about adding config option for stringify and parse methods?

@johannesnagl
Copy link

The Gozala/querystring repo has the same PR: Gozala/querystring#10

@sindresorhus
Copy link
Owner

Yeah sure, if someone does a good pull request with tests.

rapzo pushed a commit to rapzo/query-string that referenced this issue Nov 10, 2016
@rapzo
Copy link
Contributor

rapzo commented Nov 15, 2016

See #79

@sindresorhus
Copy link
Owner

Fixed by #79.

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

No branches or pull requests

6 participants