class header_map#

class header_map#

Provides access to the HTTP headers.

Public Functions

header_map() = default#

Construct an empty header map.

inline auto empty() const noexcept -> bool#

Check whether the container is empty.

inline auto size() const noexcept -> size_type#

Get the number of key/value pairs.

inline auto contains(std::string_view name) const -> bool#

Checks whether the container contains element with specific key.

DESCRIPTION

Checks whether the container contains element with specific key. The input name will be canonicalized before searching.

inline auto contains(http::field name) const -> bool#

Checks whether the container contains element with specific key.

DESCRIPTION

Checks whether the container contains element with specific key.

inline void clear() noexcept#

Clear the contents.

inline void set(std::string_view name, std::string_view value)#

Set HTTP headers.

DESCRIPTION

Set HTTP headers. The input name will be canonicalized before insertion. Note that any existing headers with the same name will be removed before the insertion.

inline void set(http::field name, std::string_view value)#

Set HTTP headers.

DESCRIPTION

Set HTTP headers. Note that any existing headers with the same name will be removed before the insertion.

inline void insert(std::string_view name, std::string_view value)#

Insert HTTP headers.

DESCRIPTION

Insert HTTP headers. The input name will be canonicalized before insertion. Note that any existing headers with the same name will be kept.

inline void insert(http::field name, std::string_view value)#

Insert HTTP headers.

DESCRIPTION

Insert HTTP headers. Note that any existing headers with the same name will be kept.

inline auto get(std::string_view name) const noexcept -> optional<mapped_type>#

Get header with specific key.

DESCRIPTION

Get header with specific key. The input name will be canonicalized before searching. Note that if there are multiple headers with the same name, only the first one will be returned. Consider using equal_range instead for iterating all the headers with the same name.

inline auto get(http::field name) const noexcept -> optional<mapped_type>#

Get header with specific key.

DESCRIPTION

Get header with specific key. Note that if there are multiple headers with the same name, only the first one will be returned. Consider using equal_range instead for iterating all the headers with the same name.

inline auto equal_range(std::string_view name) const -> std::pair<iterator, iterator>#

Get range of elements matching a specific key.

DESCRIPTION

Get range of elements matching a specific key. The input name will be canonicalized before searching.

inline auto equal_range(http::field name) const -> std::pair<iterator, iterator>#

Get range of elements matching a specific key.

DESCRIPTION

Get range of elements matching a specific key.

inline auto erase(std::string_view name) -> size_type#

Remove element with specific key.

DESCRIPTION

Remove element with specific key. The input name will be canonicalized before searching.

inline auto erase(http::field name) -> size_type#

Remove element with specific key.

DESCRIPTION

Remove element with specific key.

inline auto begin() noexcept -> iterator#

Get an iterator to the beginning.

inline auto begin() const noexcept -> const_iterator#

Get an iterator to the beginning.

inline auto cbegin() const noexcept -> const_iterator#

Get an iterator to the beginning.

inline auto end() noexcept -> iterator#

Get an iterator to the end.

inline auto end() const noexcept -> const_iterator#

Get an iterator to the end.

inline auto cend() const noexcept -> const_iterator#

Get an iterator to the end.