SetCookieInit
Summary
Initializer for a Set-Cookie header value.
Signature
interface SetCookieInit {
domain?: string;
expires?: Date;
httpOnly?: boolean;
maxAge?: number;
name?: string;
partitioned?: boolean;
path?: string;
sameSite?: SameSiteValue;
secure?: boolean;
value?: string;
}
Properties
domain
The domain of the cookie. For example, example.com.
expires
The expiration date of the cookie. If not specified, the cookie is a session cookie that is removed when the browser is closed.
httpOnly
Indicates this cookie should not be accessible via JavaScript.
maxAge
The maximum age of the cookie in seconds.
name
The name of the cookie.
partitioned
Indicates this cookie is a partitioned cookie.
path
The path of the cookie. For example, / or /admin.
sameSite
The SameSite attribute of the cookie. This attribute lets servers require that a cookie shouldn't be sent with
cross-site requests, which provides some protection against cross-site request forgery attacks.
secure
Indicates the cookie should only be sent over HTTPS.
value
The value of the cookie.