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

wrap-nested-params doesn't support repeated parameters #22

Closed
nicolas-ginder opened this issue Oct 2, 2012 · 3 comments
Closed

wrap-nested-params doesn't support repeated parameters #22

nicolas-ginder opened this issue Oct 2, 2012 · 3 comments

Comments

@nicolas-ginder
Copy link

When using wrap-nested-params , parameters like:
http://someurl?param=value1&param=value2
are mapped to
{:params {:param "value2"}} instead of {:params {:param [ "value1" "value2"]}} in the request map.

@asmala
Copy link

asmala commented Nov 14, 2012

I believe the URL syntax should be http://someurl?param[]=value1&param[]=value2.

@Josh-Tilles
Copy link

@asmala You're sorta correct. The syntax for PHP does require the [] suffix. However, according to this StackOverflow post, the suffix is just a PHP-ism.

The way I understand it:
If there's a GET request at http://someurl?argument=original, then the result of calling (.getParameterValues req "argument") would be ["original"] and the result of calling (.getParameterValue req "argument") would be "original".
If there's a GET request at http://someurl?argument=shadowing&argument=original, then the result of calling (.getParameterValues req "argument") would be ["shadowing" "original"], but the result of (.getParameterValue req "argument") would be "shadowing".

@weavejester, do you have an opinion on how to handle this?

@Josh-Tilles
Copy link

From looking at the current tests, it seems like Ring supports the PHP-style nested parameters. So I guess the main question is whether it should support both.

...time goes by in which I get distracted trying to implement this...

OH okay, if there is a problem, it doesn't (solely?) reside in ring.middleware.nested-params. I discovered this when writing a test for (array-map "foo" "bar" "foo" "baz"); if wrap-nested-params receives the parameters already as a map, then the fact that one input "key" had two values has been lost.

...goes off to explore the Ring codebase again...

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

3 participants