zooniverse / json-api-client

Apache License 2.0
10 stars 5 forks source link

Pre-join arrays in query values #25

Closed brian-c closed 8 years ago

brian-c commented 8 years ago

superagent seems to expand array values into a query with duplicate keys.

{slugs: ['a', 'b', 'c']} would become ?slugs=a&slugs=b&slugs=c.

Maybe that's HTML form style?

This makes it become ?slugs=a,b,c like it used to.

eatyourgreens commented 8 years ago

Array inputs in HTML forms use [] at the end of the input name, so the query params are sent as slugs[]=a&slugs[]=b&slugs[]=c. Rails should recognise an array using that syntax, but I'd guess the key would have to be quoted in javascript {'slugs[]' : [a,b,c]}.