containsHeader
mach::Response::containsHeader
Checks whether the response contains a header.
Description
Section titled “Description”Determines whether the response contains an HTTP header with the specified name.
Syntax
Section titled “Syntax”[[nodiscard]] bool containsHeader(std::string_view name) const noexcept;Return Value
Section titled “Return Value”true if the response contains the specified header; otherwise, false.
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
name |
The name of the header to check. |
Exceptions
Section titled “Exceptions”This function is noexcept and does not throw exceptions.
Remarks
Section titled “Remarks”Header names are case-insensitive.
Thread Safety
Section titled “Thread Safety”This function is thread-safe.
Example
Section titled “Example”if (response().containsHeader("Content-Type")) { // ...}See Also
Section titled “See Also”| Name | Description |
|---|---|
header |
Returns the value of a response header. |
setHeader |
Sets a response header. |