Skip to content
Download

containsCookie

mach::Request::containsCookie

Checks whether the request contains a cookie.

Determines whether the request contains a cookie with the specified name.

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

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

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

Cookie names are case-sensitive.

This function is thread-safe.

if (request().containsCookie("session")) {
// ...
}
Name Description
cookie Returns the value of a request cookie.