httpoison_form_data v0.1.3 FormData.Formatters.URLEncoded
Link to this section Summary
Functions
Format a stream
of key-value tuples for URL Encoded requests
Link to this section Types
Link to this section Functions
Link to this function
output(stream, arg2)
output(stream :: Enum.t(), opts :: options()) :: FormData.Formatters.URLEncoded.t()
Format a stream
of key-value tuples for URL Encoded requests.
Since URLEncoded parameters can be used in GET and POST requests, the
options
hash includes a :get
option. The default output is valid form
data for a call to HTTPoison.post
. The output with the :get
flag is valid
data for a call to HTTPoison.get
.
If a different HTTP library is in use, or if the URL string needs to be
modified, the :url
flag can be set to output the proper URL string.
Examples
iex> FormData.Formatters.URLEncoded.output([{"Name", "Value"}, {"Name2", "Value2"}], [])
{:form, [{"Name", "Value"}, {"Name2", "Value2"}]}
iex> FormData.Formatters.URLEncoded.output([{"Name", "Value"}, {"Name2", "Value2"}], get: true)
[params: [{"Name", "Value"}, {"Name2", "Value2"}]]
iex> FormData.Formatters.URLEncoded.output([{"Name", "Value"}, {"Name2", "Value2"}], url: true)
"?Name=Value&Name2=Value2"