containsCookie
mach::Request::containsCookie
Checks whether the request contains a cookie.
Description
Section titled “Description”Determines whether the request contains a cookie with the specified name.
Syntax
Section titled “Syntax”[[nodiscard]] bool containsCookie(std::string_view name) const;Return Value
Section titled “Return Value”true if the request contains the specified cookie; otherwise, false.
Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
name |
The name of the cookie to check. |
Exceptions
Section titled “Exceptions”| Exception | Condition |
|---|---|
std::bad_alloc |
Thrown if memory allocation fails. |
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 (request().containsCookie("session")) { // ...}See Also
Section titled “See Also”| Name | Description |
|---|---|
cookie |
Returns the value of a request cookie. |