Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
@benoitc
225 lines (115 sloc) 5.63 kb

Module hackney_headers

module to manipulate HTTP headers.

Data Types

compat_dict()


compat_dict() = dict:dict()

compat_dict()


compat_dict() = dict:dict()

disposition()


disposition() = {binary(), [{binary(), binary()}]}

Function Index

content_disposition/1Parse a content disposition.
content_type/1Parse a content type.
delete/2Delete the header corresponding to key if it is present.
fold/3fold the list of headers.
get_value/2get the value of the header.
get_value/3
header_value/2join value and params in a binary.
insert/3Insert the pair into the headers, merging with any pre-existing key.
insert/4same as insert/3 but allows to add params to the header value.
make_header/2Create a binary header.
make_header/3
new/0initialise an header dict.
new/1
parse/2Semantically parse headers.
store/3store the pair into the headers, replacing any pre-existing key.
to_binary/1return all the headers as a binary that can be sent over the wire.
to_list/1
update/2extend the headers with a new list of {Key, Value} pair.

Function Details

content_disposition/1


content_disposition(Data::binary()) -> disposition()


Parse a content disposition.

content_type/1


content_type(Data::binary()) -> any()


Parse a content type.

We lowercase the charset header as we know it's case insensitive.

delete/2

delete(Key, Headers) -> any()

Delete the header corresponding to key if it is present.

fold/3

fold(Fun, Acc0, Headers) -> any()

fold the list of headers

get_value/2

get_value(Key, Headers) -> any()

get the value of the header

get_value/3

get_value(Key, Headers, Default) -> any()

header_value/2

header_value(Value, Params) -> any()

join value and params in a binary

insert/3

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/4

insert(Key, Value, Params, Headers) -> any()

same as insert/3 but allows to add params to the header value.

make_header/2

make_header(Name, Value) -> any()

Create a binary header

make_header/3

make_header(Name, Value, Params) -> any()

new/0


new() -> compat_dict()


initialise an header dict

new/1


new(D::{dict, compat_dict()} | list()) -> compat_dict()


parse/2


parse(Name::binary(), Headers::list() | compat_dict()) -> 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/3

store(Key, Value, Headers) -> any()

store the pair into the headers, replacing any pre-existing key.

to_binary/1

to_binary(Headers) -> any()

return all the headers as a binary that can be sent over the wire.

to_list/1

to_list(Headers) -> any()

update/2

update(Headers, KVs) -> any()

extend the headers with a new list of {Key, Value} pair.

Jump to Line
Something went wrong with that request. Please try again.