Skip to content
Download

containsHeader

mach::Response::containsHeader

Checks whether the response contains a header.

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

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

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

Parameter Description
name The name of the header to check.

This function is noexcept and does not throw exceptions.

Header names are case-insensitive.

This function is thread-safe.

if (response().containsHeader("Content-Type")) {
// ...
}
Name Description
header Returns the value of a response header.
setHeader Sets a response header.