Skip to content

Latest commit

 

History

History
271 lines (159 loc) · 7.5 KB

hackney_headers_new.md

File metadata and controls

271 lines (159 loc) · 7.5 KB

Module hackney_headers_new

Data Types


headers() = term()

headers_list() = [{key(), value()}]

key() = binary() | string()

value() = binary() | {binary() | [{binary(), binary()} | binary()]}

Function Index

append/3append 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/2delete a field from headers.
fold/3
from_list/1create headers from a list.
get_value/2get the first value of an headers or return undefined.
get_value/3get the first value of an headers or return the default.
is_key/2is the header field exists or no.
lookup/2
merge/2merge 2 headers objects.
new/0initialize an empty headers objecy.
new/1
parse_content_type/1
parse_media_type/2Parse a media type.
size/1return the number of headers fields.
store/2store a list of headers.
store/3replace the content of the header field with the value or the list of values.
store_new/3only store a value if the key exist.
to_binary/1transform headers to a binary that can be used to construct a request.
to_iolist/1convert headers to an iolist.
to_list/1convert headers to a list.

Function Details

append/3


append(Key::key(), Value::value(), X3::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/2


delete(Key::key(), H::headers()) -> headers()

delete a field from headers.

fold/3

fold(Fun, Acc, X3) -> any()

from_list/1


from_list(HeadersList::headers_list()) -> headers()

create headers from a list

get_value/2


get_value(Key::key(), Headers::headers()) -> value() | undefined

get the first value of an headers or return undefined

get_value/3


get_value(Key::key(), Headers::headers(), Default::any()) -> value() | any()

get the first value of an headers or return the default

is_key/2


is_key(Key::key(), X2::headers()) -> true | false

is the header field exists or no

lookup/2

lookup(Key, X2) -> any()

merge/2


merge(Headers1::headers(), X2::headers()) -> headers()

merge 2 headers objects. If a key is already existing in HEader1, it will be kept.

new/0


new() -> headers()

initialize an empty headers objecy

new/1


parse_content_type/1


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

parse_media_type/2


parse_media_type(Data::binary(), Fun::function()) -> any()

Parse a media type.

size/1


size(X1::headers()) -> non_neg_integer()

return the number of headers fields

store/2


store(KVs::headers_list(), Headers::headers()) -> headers()

store a list of headers. Replacing oldest

store/3


store(Key::key(), Values::value() | [value()], X3::headers()) -> headers()

replace the content of the header field with the value or the list of values.

store_new/3


store_new(Key::key(), Value::value(), Headers::headers()) -> {boolean(), headers()}

only store a value if the key exist.

to_binary/1


to_binary(Headers::headers()) -> binary()

transform headers to a binary that can be used to construct a request

to_iolist/1


to_iolist(Headers::headers()) -> iolist()

convert headers to an iolist. Useful to send them over the wire.

to_list/1


to_list(Headers::headers()) -> headers_list()

convert headers to a list