CookieOptions
Attributes of a cookie.
Attributes of a cookie. Secure defaults apply when omitted.
Import#
ts
import type { CookieOptions } from "@shadow-js/dusk/server";
Signature#
ts
interface CookieOptions {
/** `Domain`. Omit for a host-only cookie (recommended; required by `__Host-`). */
readonly domain?: string;
/** `Path`. Default `"/"`. */
readonly path?: string;
/** `Max-Age` in seconds. Omit for a session cookie. */
readonly maxAge?: number;
/** `Expires`. Prefer `maxAge`. */
readonly expires?: Date;
/** Default `true`: scripts cannot read the cookie. */
readonly httpOnly?: boolean;
/** Default `true`: only sent over https (and to localhost in browsers). */
readonly secure?: boolean;
/** Default `"lax"`. */
readonly sameSite?: "lax" | "strict" | "none";
/** `Partitioned` (CHIPS). */
readonly partitioned?: boolean;
}
Members#
| Name | Type | Description |
|---|---|---|
domain? |
readonly domain?: string |
Domain. Omit for a host-only cookie (recommended; required by __Host-). |
path? |
readonly path?: string |
Path. Default "/". |
maxAge? |
readonly maxAge?: number |
Max-Age in seconds. Omit for a session cookie. |
expires? |
readonly expires?: Date |
Expires. Prefer maxAge. |
httpOnly? |
readonly httpOnly?: boolean |
Default true: scripts cannot read the cookie. |
secure? |
readonly secure?: boolean |
Default true: only sent over https (and to localhost in browsers). |
sameSite? |
readonly sameSite?: "lax" | "strict" | "none" |
Default "lax". |
partitioned? |
readonly partitioned?: boolean |
Partitioned (CHIPS). |