View Source hackney_headers_new (hackney v1.23.0)

Summary

Functions

append a new value to the list of value for the the header field if the key has not been recorded the list will be created with the value as the first item.
delete a field from headers.
create headers from a list
get the first value of an headers or return undefined
get the first value of an headers or return the default
is the header field exists or no
merge 2 headers objects. If a key is already existing in HEader1, it will be kept.
initialize an empty headers objecy
Parse a media type.
return the number of headers fields
store a list of headers. Replacing oldest
replace the content of the header field with the value or the list of values.
only store a value if the key exist.
transform headers to a binary that can be used to construct a request
convert headers to an iolist. Useful to send them over the wire.
convert headers to a list

Types

headers/0

-type headers() :: term().

headers_list/0

-type headers_list() :: [{key(), value()}].

key/0

-type key() :: binary() | string().

value/0

-type value() :: binary() | {binary() | [{binary(), binary()} | binary()]}.

Functions

append(Key, Value, _)

-spec append(key(), value(), headers()) -> headers().
append a new value to the list of value for the the header field if the key has not been recorded the list will be created with the value as the first item.

delete(Key, H)

-spec delete(key(), headers()) -> headers().
delete a field from headers.

fold(Fun, Acc, _)

from_list(HeadersList)

-spec from_list(headers_list()) -> headers().
create headers from a list

get_value(Key, Headers)

-spec get_value(key(), headers()) -> value() | undefined.
get the first value of an headers or return undefined

get_value(Key, Headers, Default)

-spec get_value(key(), headers(), any()) -> value() | any().
get the first value of an headers or return the default

is_key(Key, _)

-spec is_key(key(), headers()) -> true | false.
is the header field exists or no

lookup(Key, _)

merge(Headers1, _)

-spec merge(headers(), headers()) -> headers().
merge 2 headers objects. If a key is already existing in HEader1, it will be kept.

new()

-spec new() -> headers().
initialize an empty headers objecy

new(H)

-spec new(headers_list() | headers()) -> headers().

parse_content_type(Data)

-spec parse_content_type(binary()) -> any().

parse_media_type(Data, Fun)

-spec parse_media_type(binary(), fun()) -> any().
Parse a media type.

size(_)

-spec size(headers()) -> non_neg_integer().
return the number of headers fields

store(KVs, Headers)

-spec store(headers_list(), headers()) -> headers().
store a list of headers. Replacing oldest

store(Key, Values, _)

-spec store(key(), value() | [value()], headers()) -> headers().
replace the content of the header field with the value or the list of values.

store_new(Key, Value, Headers)

-spec store_new(key(), value(), headers()) -> {boolean(), headers()}.
only store a value if the key exist.

to_binary(Headers)

-spec to_binary(headers()) -> binary().
transform headers to a binary that can be used to construct a request

to_iolist(Headers)

-spec to_iolist(headers()) -> iolist().
convert headers to an iolist. Useful to send them over the wire.

to_list(Headers)

-spec to_list(headers()) -> headers_list().
convert headers to a list