Skip to content
Download

containsHeader

mach::Request::containsHeader

Checks whether the request contains a header.

Determines whether the request contains an HTTP header with the specified name.

[[nodiscard]] bool containsHeader(std::string_view name) const;

true if the request contains the specified header; otherwise, false.

Parameter Description
name The name of the header to check.
Exception Condition
std::bad_alloc Thrown if memory allocation fails.

Header names are case-insensitive.

This function is thread-safe.

if (request().containsHeader("Authorization")) {
// ...
}
Name Description
header Returns the value of a request header.