Closed bpajk closed 7 months ago
I believe this is related https://github.com/elixir-plug/plug/issues/1210
I have checked the https://github.com/elixir-plug/plug/issues/1210 which helped to solve this issue.
Looks like I can achieve what I want by writing the query like so: ?obj_arr[in][]=val1&obj_arr[in][]=val2
this results in:
%{"obj_arr" => %{"in" => ["val1", "val2"]}}
Thank you!
Hello, I am trying to send a list of values in query parameters using the key-value notation, but I am not getting the expected results.
Key-Value We can pass query parameters as key-value pairs like this: ?obj[eq]=val
Fetched query parameters for this request would be:
%{ "obj" => %{"eq" => "val"} }
List of value Similarly we can pass a list using the array notation: ?arr[]=val1&arr[]=val2
This would yield:
%{ "arr" => ["val1", "val2"] }
Key-Value where value is a list But if we try passing a list of key-value pairs we only get the last value ?obj_arr[in]=val1&obj_arr[in]=val2
This yields:
%{ "obj_arr" => %{"in" => "val2"} }
Expected result It would be nice, if the request above would result in:
%{ "obj_arr" => %{"in" =>[ "val1", "val2"]} }
I am using: Erlang/OTP 26 Elixir 1.16.0 plug_cowboy 2.7.0