public class MockCookie extends Cookie
Cookie with extra attributes, as defined in
RFC 6265.| Constructor and Description |
|---|
MockCookie(String name,
String value)
Constructor with the cookie name and value.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getSameSite()
Return the "SameSite" attribute, or
null if not set. |
static MockCookie |
parse(String setCookieHeader)
Factory method that parses the value of a "Set-Cookie" header.
|
void |
setSameSite(String sameSite)
Add the "SameSite" attribute to the cookie.
|
clone, getComment, getDomain, getMaxAge, getName, getPath, getSecure, getValue, getVersion, isHttpOnly, setComment, setDomain, setHttpOnly, setMaxAge, setPath, setSecure, setValue, setVersionpublic MockCookie(String name, String value)
name - the namevalue - the valueCookie.Cookie(String, String)public void setSameSite(@Nullable String sameSite)
This limits the scope of the cookie such that it will only be attached
to same site requests if "Strict" or cross-site requests if
"Lax".
@Nullable public String getSameSite()
null if not set.public static MockCookie parse(String setCookieHeader)
setCookieHeader - the "Set-Cookie" value; never null or empty