Closed Sed9yDataBank closed 2 years ago
I am using tesla + plug to POST some data to an image processing API.
POST
I am using this to encode the URL
plug Tesla.Middleware.FormUrlencoded, encode: &Plug.Conn.Query.encode/1, decode: &Plug.Conn.Query.decode/1
This is what I am sending green=yes&blue=no&shades[]=300&shades[]=199
%{ "shades" => [300, 199], "green" => "yes, "blue" => "no" }
Notice how I have the same parameter shades with two values 300 and 199
Unfortunately the image processing API returns 'shades' is missing
The parameter is shades not shades[] so I should be sending green=yes&blue=no&shades=300&shades=199 without the square brackets.
shades
shades[]
green=yes&blue=no&shades=300&shades=199
Along side to This https://github.com/elixir-plug/plug/blob/dc20b7639157eae9be428ce032e69b2f3a3cfbef/lib/plug/conn/query.ex#L241, Shouldn't there be an option to support the above use case?
I am not sure how frequent such encoding is, so my recommendation for now is to either encode it by hand or have your own version of the encoding functionality. :) Thank you!
Got it! thanks
Feature Request
I am using tesla + plug to
POST
some data to an image processing API.I am using this to encode the URL
This is what I am sending green=yes&blue=no&shades[]=300&shades[]=199
Notice how I have the same parameter shades with two values 300 and 199
Unfortunately the image processing API returns 'shades' is missing
The parameter is
shades
notshades[]
so I should be sendinggreen=yes&blue=no&shades=300&shades=199
without the square brackets.Along side to This https://github.com/elixir-plug/plug/blob/dc20b7639157eae9be428ce032e69b2f3a3cfbef/lib/plug/conn/query.ex#L241, Shouldn't there be an option to support the above use case?