Skip to content
Download

containsCookie

mach::Response::containsCookie

Checks whether the response contains a cookie.

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

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

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

Parameter Description
name The name of the cookie to check.

This function is noexcept and does not throw exceptions.

Cookie names are case-sensitive.

This function is thread-safe.

if (response().containsCookie("session")) {
// ...
}
Name Description
cookie Returns a cookie from the response.
addCookie Adds a cookie to the response.