cookie

Requires a request cookie with name to match predicate.

The predicate receives the decoded cookie value, or null when the cookie is absent. Request cookies only carry a name and value in the Cookie header; response-only attributes such as Path, HttpOnly, Secure, or SameSite are not available for request matching.

Example:

mokksy.get {
path("/profile")
cookie("session") { it?.startsWith("sess_") == true }
}

Return

The same instance of RequestSpecificationBuilder.

Parameters

name

Cookie name.

predicate

Predicate applied to the decoded cookie value.


Requires a request cookie with name to equal value.

Example:

mokksy.get {
path("/profile")
cookie("session", "abc")
}

Return

The same instance of RequestSpecificationBuilder.

Parameters

name

Cookie name.

value

Expected decoded cookie value.