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

urlEncodeVars does not properly encode arrays #88

Closed
tfausak opened this issue Jul 22, 2015 · 1 comment
Closed

urlEncodeVars does not properly encode arrays #88

tfausak opened this issue Jul 22, 2015 · 1 comment

Comments

@tfausak
Copy link

tfausak commented Jul 22, 2015

When urlEncodeVars encounters keys with multiple values, it separates the values with commas. For example:

urlEncodeVars [("k", "1"), ("k", "2")]
-- "k=1,2"

In my experience, the correct way to encode arrays like this is to append [] to the key and pass each element as a key-value pair. For instance:

urlEncode "[]"
-- "%5B%5D"
urlEncodeVars' [("k", "1"), ("k", "2")]
-- "k%5B%5D=1k%5B%5D=2"

Is it possible to change the behavior of urlEncodeVars to match my expectation?

@tfausak
Copy link
Author

tfausak commented Sep 11, 2015

I worked around this by using urlEncode directly and adding the square brackets myself. If nobody else was surprised by this behavior in the (at least) six years since urlEncodeVars was introduced, I can deal with it.

@tfausak tfausak closed this as completed Sep 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant