Skip to content

Instantly share code, notes, and snippets.

@cored
Created February 21, 2018 13:58
Show Gist options
  • Save cored/bf75c663e31be4688e8734e644e7fa4a to your computer and use it in GitHub Desktop.
Save cored/bf75c663e31be4688e8734e644e7fa4a to your computer and use it in GitHub Desktop.
@doc """
Parses
## Examples
iex>params_string = "name=Baloo&type=Brown"
iex>Servy.Parser.parse_params("application/x-www-form-urlencoded",
%{"name" => "Baloo", "type" => "Brown"})
iex>Servy.Parser.parse_params("multipart/form-data", params_string, %{})
"""
def parse_params("application/x-www-form-urlencoded", params_string) do
params_string |> String.trim |> URI.decode_query
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment