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

Array/object url is encoded/decoded in the wrong way #57

Open
golddragon007 opened this issue Mar 12, 2021 · 0 comments
Open

Array/object url is encoded/decoded in the wrong way #57

golddragon007 opened this issue Mar 12, 2021 · 0 comments

Comments

@golddragon007
Copy link

This u.query.a = [1, 2, 3]; creates a=1&a=2&a=3 while the correct is a[0]=1&a[1]=2&a[2]=3
The currently generated URL can lead to query overload, which depends on the server (apache, lighttpd or Microsoft) understand differently. While the second one is the correct array GET structure.
In languages where associative array exists, the following is also valid:
For u.query.a = ['key1' => 1, 'key5' => 2, 'key3' => 3]; represented as a[key1]=1&a[key5]=2&a[key3]=3, this is most probably represented in JS as an object like u.query.a = {"key1": 1, "key5": 2, "key3": 3};.
Also, servers support multidimensional array/objects, which's not supported here.
u.query.a = [1, [2, 5], 3]; as a[0]=1&a[1][0]=2&a[1][1]=5&a[2]=3
u.query.a = {"key1": 1, "key5": [2, 5], "key3": 3}; as a[key1]=1&a[key5][0]=2&a[key5][1]=5&a[key3]=3
u.query.a = {"key1": 1, "key5": {"key1": 2, "key6": 5}, "key3": 3}; as a[key1]=1&a[key5][key1]=2&a[key5][key6]=5&a[key3]=3

@golddragon007 golddragon007 changed the title Array url is encoded/decoded in the wrong way Array/object url is encoded/decoded in the wrong way Mar 12, 2021
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