Decodes x-www-form-urlencoded query strings into Elixir maps.
This mirrors the semantics of Plug.Conn.Query.decode/1 so that Passby
handlers receive the exact same conn.query_params/conn.params shape they
would get from Bypass, without depending on Plug.
iex> Passby.Conn.Query.decode("filter[name]=Manuel")
%{"filter" => %{"name" => "Manuel"}}
iex> Passby.Conn.Query.decode("tags[]=a&tags[]=b")
%{"tags" => ["a", "b"]}Rules:
foo=barbecomes%{"foo" => "bar"}.- A repeated scalar key keeps the last value:
foo=1&foo=2->%{"foo" => "2"}. - A key without a value is treated as an empty string:
foo->%{"foo" => ""}. foo[bar]=bazbuilds nested maps:%{"foo" => %{"bar" => "baz"}}.foo[]=a&foo[]=bbuilds a list, preserving order:%{"foo" => ["a", "b"]}.- Keys and values are URL-decoded (
+becomes a space,%XXoctets are decoded).
Nesting inside lists (for example foo[][bar]=1) is ambiguous and its exact
output should not be relied upon, matching Plug.
Summary
Functions
Decodes the given query string into a map.