Skip to content

Conversation

@jarkt
Copy link

@jarkt jarkt commented Oct 13, 2015

Object.toQueryString({
  "a": [1, 2],
  "b": {"": [3, 4], "x": "y"},
  "c": null,
  "d": "e"
})

Old result: a[0]=1&a[1]=2&b[][0]=3&b[][1]=4&b[x]=y&d=e
New result: a=1&a=2&b[]=3&b[]=4&b[x]=y&d=e

Object.toQueryString({
  "a": [1, 2],
  "b": {"": [3, 4], "x": "y"},
  "c": null,
  "d": "e"
})

Old result: a[0]=1&a[1]=2&b[][0]=3&b[][1]=4&b[x]=y&d=e
New result: a=1&a=2&b[]=3&b[]=4&b[x]=y&d=e
@SergioCrisostomo
Copy link
Member

@jarkt thank you for the fix suggestion!

There are specs failing with this code suggestion. Which means a BC (breaking change).

Which issue is this fixing? Is this related with URI issues in More?

@jarkt
Copy link
Author

jarkt commented Oct 13, 2015

Yes exactly. The function shouldn’t automatically number parameters with the same name. I think the specs are wrong.

Object.toQueryString("a[]=1&a[]=2".parseQueryString())

This should return only the input string, but instead mootools adds one more dimension and returns "a[][0]=1&a[][1]=2".
parseQueryString and toQueryString actually don’t work fine together.

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

Successfully merging this pull request may close these issues.

2 participants