module to manipulate HTTP headers.
disposition() = {binary(), [{binary(), binary()}]}
headers() = any()
content_disposition/1 | Parse a content disposition. |
content_type/1 | Parse a content type. |
delete/2 | Delete the header corresponding to key if it is present. |
fold/3 | fold the list of headers. |
get_value/2 | get the value of the header. |
get_value/3 | |
header_value/2 | join value and params in a binary. |
insert/3 | Insert the pair into the headers, merging with any pre-existing key. |
insert/4 | same as insert/3 but allows to add params to the header value. |
make_header/2 | Create a binary header. |
make_header/3 | |
new/0 | initialise an header dict. |
new/1 | |
parse/2 | Semantically parse headers. |
store/3 | store the pair into the headers, replacing any pre-existing key. |
to_binary/1 | return all the headers as a binary that can be sent over the wire. |
to_list/1 | |
update/2 | extend the headers with a new list of {Key, Value} pair. |
content_disposition(Data::binary()) -> disposition()
Parse a content disposition.
content_type(Data::binary()) -> any()
Parse a content type.
We lowercase the charset header as we know it's case insensitive.
delete(Key, Headers) -> any()
Delete the header corresponding to key if it is present.
fold(Fun, Acc0, Headers) -> any()
fold the list of headers
get_value(Key, Headers) -> any()
get the value of the header
get_value(Key, Headers, Default) -> any()
header_value(Value, Params) -> any()
join value and params in a binary
insert(Key, Value, Headers) -> any()
Insert the pair into the headers, merging with any pre-existing key. A merge is done with Value = V0 ++ ", " ++ V1.
insert(Key, Value, Params, Headers) -> any()
same as insert/3
but allows to add params to the header value.
make_header(Name, Value) -> any()
Create a binary header
make_header(Name, Value, Params) -> any()
new() -> headers()
initialise an header dict
new(D::list()) -> headers()
parse(Name::binary(), Headers::list() | headers()) -> any() | undefined | {error, badarg}
Semantically parse headers.
When the value isn't found, a proper default value for the type returned is used as a return value.
See also: parse/3.
store(Key, Value, Headers) -> any()
store the pair into the headers, replacing any pre-existing key.
to_binary(Headers) -> any()
return all the headers as a binary that can be sent over the wire.
to_list(Headers) -> any()
update(Headers, KVs) -> any()
extend the headers with a new list of {Key, Value}
pair.