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

RequestAdapter does not support multiple values for query params #22

Closed
franklinhu opened this Issue Aug 29, 2012 · 2 comments

Comments

3 participants
@franklinhu

franklinhu commented Aug 29, 2012

If you want to send an array as query parameters to a GET request, jQuery encodes it as follows

var a = {key: [1,2,3]}
$.param(a) // key[]=1&key[]=2&key[]=3

For nested hashes:

var b = {key1: {field1:1, field2: 2}, key2: {field1: 2, field2: 89}}
$.param(b) // key1[field1]=1&key1[field2]=2&key2[field1]=2&key2[field2]=89

There can obviously be some pretty complicated nesting of these.

Currently Finatra only pulls the head off a set of query parameters that all have the same key (first example would give only one of them). It would be nice to return the set of all values, otherwise it requires a bit of application logic/coordination to figure out which keys are actually present.

https://github.com/capotej/finatra/blob/master/src/main/scala/com/twitter/finatra/RequestAdapter.scala#L39

@capotej

This comment has been minimized.

Contributor

capotej commented Aug 29, 2012

Ah, good catch. I'll see what I can whip up

@scosenza

This comment has been minimized.

Contributor

scosenza commented May 2, 2015

Finatra v2 now directly uses Finagle's HTTP Request, so you can call request.getParams(...) to get all query values.

@scosenza scosenza closed this May 2, 2015

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