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

Parse many query parameters without [] #814

Closed
LostKobrakai opened this issue Jan 27, 2019 · 1 comment
Closed

Parse many query parameters without [] #814

LostKobrakai opened this issue Jan 27, 2019 · 1 comment

Comments

@LostKobrakai
Copy link
Contributor

I'm looking into creating a webfinger server component and it seems plug cannot parse requests like:

GET /.well-known/webfinger?
        resource=acct%3Abob%40example.com&
        rel=http%3A%2F%2Fwebfinger.example%2Frel%2Fprofile-page&
        rel=http%3A%2F%2Fwebfinger.example%2Frel%2Fbusinesscard HTTP/1.1
    Host: example.com

Source

I'll only get the latter rel, but not both. What would be the recommended path of action here?

@josevalim
Copy link
Member

josevalim commented Jan 27, 2019

It is not possible out of the box. You would have to implement your own decoding or use the URI module:

iex(2)> URI.query_decoder("foo=1&bar=2&bar=3") |> Enum.into([])
[{"foo", "1"}, {"bar", "2"}, {"bar", "3"}]

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

2 participants