containsCookie
mach::Response::containsCookie
Checks whether the response contains a cookie.
Description
Section titled “Description”Determines whether the response contains a cookie with the specified name.
Syntax
Section titled “Syntax”[[nodiscard]] bool containsCookie(std::string_view name) const noexcept;Return Value
Section titled “Return Value”true if the response contains the specified cookie; otherwise, false.
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
name |
The name of the cookie to check. |
Exceptions
Section titled “Exceptions”This function is noexcept and does not throw exceptions.
Remarks
Section titled “Remarks”Cookie names are case-sensitive.
Thread Safety
Section titled “Thread Safety”This function is thread-safe.
Example
Section titled “Example”if (response().containsCookie("session")) { // ...}See Also
Section titled “See Also”| Name | Description |
|---|---|
cookie |
Returns a cookie from the response. |
addCookie |
Adds a cookie to the response. |