wojtekmach / req

Req is a batteries-included HTTP client for Elixir.
https://hexdocs.pm/req
Apache License 2.0
1.09k stars 116 forks source link

`put_path_params`: Should it work with query params? #424

Open wojtekmach opened 2 weeks ago

wojtekmach commented 2 weeks ago

I was surprised this didn't work:

iex> Req.get!("https://httpbin.org/anything?x=:x", path_params: [x: 1]).body["args"]
%{"x" => ":x"}

I mean, it makes sense, it's called path params after all but still. Of course we could do this instead:

iex> Req.get!("https://httpbin.org/anything", params: [x: 1]).body["args"]
%{"x" => "1"}

but with :path_params feature we of course can get better instrumentation. I wonder if status quo is good enough or perhaps we can do some improvements?

cc @bryannaegele @whatyouhide

P.S. We're still planning to emit our own telemetry events, https://github.com/wojtekmach/req/issues/341.

whatyouhide commented 2 weeks ago

Maybe we should think about it this way: if someone wants to use the path params in their own tagging system for instrumentation, they should do so in their Telemetry handlers instead?