ivar v0.8.1 Ivar.Headers
Ivar.Headers
manages the request headers used for a request
Summary
Functions
Puts the given headers
into the existing request
map
Puts the given value
under key
into the request
headers map
Functions
Puts the given headers
into the existing request
map
Args
request
- the map used to store the map of headers, usually created viaIvar.new/2
headers
- the headers to be put into the headers map
Headers
- Key/value tuple -
{:header, "value"}
or{"header", "value"}
- List of Key/value tuple -
[{:header, "value"}]
- Keyword list -
[header: "value"]
- Map -
%{header: "value"}
Usage
iex> Ivar.Headers.put(%{}, [accept: "application/json"])
%{headers: %{"accept" => "application/json"}}
Puts the given value
under key
into the request
headers map
Args
request
- the map used to store the map of headers, usually created viaIvar.new/2
key
- the header name as string or atom (e.g.:header
or"header"
)value
- the header value
Usage
iex> Ivar.Headers.put(%{}, :accept, "application/json")
%{headers: %{"accept" => "application/json"}}