Idiom to construct a URI with a query string in Elixir
问题 I'm wondering what the most idiomatic way is to use URI to add a query string to a base URI in Elixir. I'm currently doing something like this: iex(1)> base = "http://example.com/endpoint" "http://example.com/endpoint" iex(2)> query_string = URI.encode_query(foo: "bar") "foo=bar" iex(3)> uri_string = URI.parse(base) |> Map.put(:query, query_string) |> URI.to_string "http://example.com/endpoint?foo=bar" But was wondering if there is a cleaner way to set the query string. I know about URI.merge