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

Uri query parsing of key with [] keyword #2876

Closed
DefiPanda opened this issue Nov 2, 2014 · 3 comments
Closed

Uri query parsing of key with [] keyword #2876

DefiPanda opened this issue Nov 2, 2014 · 3 comments

Comments

@DefiPanda
Copy link
Contributor

Just a discussion. In Rails and PHP, they parse a uri of something like http://localhost:3000/?foo=1&bar[]=2&bar[]=3to Parameters: {"foo"=>"1", "bar"=>["2", "3"]}.

Yet right now we just treat bar[] as a literal string, so:

iex(1)> URI.decode_query("foo=1&bar[]=2&bar[]=3")                       
%{"bar[]" => "3", "foo" => "1"}

Is one better than another? I will really appreciate any response. 😄

@josevalim
Copy link
Member

URI only does a basic parsing, based on &, it does not provide any specific
parameter parsing. You can roll your own or use plug (which provides
something like PHP/Rails).

And remember to use the mailing list for questions the next time :)

José Valim
www.plataformatec.com.br
Skype: jv.ptec
Founder and Lead Developer

@DefiPanda
Copy link
Contributor Author

Thanks!

Will do next time.

@CrowdHailer
Copy link
Contributor

Is there any reason why URI only does basic parsing? @jw2013 did you find a roll your own library or did you just end up using plug

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

No branches or pull requests

3 participants