req icon indicating copy to clipboard operation
req copied to clipboard

Bypass URI.encode on params

Open jkbbwr opened this issue 2 years ago • 1 comments

I have a route that requires test=a,b but when passed as a param to Req it converts that into test=a%2Cb which is wrong.

Current work around is

  defp put_param_unencoded(req) do
    update_in(req.url.query, fn
      nil -> "test=a,b"
      query -> query <> "&" <> "test=a,b"
    end)
  end
  
  Req.new(...)
  |> put_param_unencoded()

jkbbwr avatar Aug 25 '22 03:08 jkbbwr

Thank you for the report. Do you know what the spec says about encoding this character and/or how other popular HTTP clients treat it? In other words, do you have a proposal how this should work in Req?

wojtekmach avatar Aug 25 '22 06:08 wojtekmach

Actually I think I am being very very stupid. Thanks for sanity checking me.

jkbbwr avatar Aug 26 '22 00:08 jkbbwr