Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/workerd/http.ts>Cookie

A JavaScript extension package for building strong and modern applications.
Latest
interface Cookie
import { type Cookie } from "https://deno.land/x/ayonli_jsext@v0.9.72/workerd/http.ts";

Represents an HTTP Cookie.

Properties

name: string

The name of the cookie.

value: string

The value of the cookie.

optional
domain: string

Defines the host to which the cookie will be sent.

optional
path: string

Indicates the path that must exist in the requested URL for the browser to send the Cookie header.

optional
expires: number

The expiration time of the cookie in milliseconds since the Unix epoch. If the value is equal to or less than the current time, the cookie will be expired immediately.

optional
maxAge: number

The number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately. If both expires and maxAge are present, maxAge has precedence.

optional
sameSite: "strict" | "lax" | "none"

Controls whether or not a cookie is sent with cross-site requests, providing some protection against cross-site request forgery attacks (CSRF).

  • strict: The cookie will only be sent in a first-party context and not be sent with requests initiated by third party websites.
  • lax: The cookie is not sent on normal cross-site sub-requests (for example to load images or frames into a third party site), but is sent when a user is navigating within the origin site (i.e. when following a link). When sameSite is not specified, this is the default behavior.
  • none: The cookie will be sent in all contexts.
optional
httpOnly: boolean

Forbids JavaScript from accessing the cookie, for example, through the document.cookie property.

optional
secure: boolean

Whether the cookie is to be used in secure contexts only, that is over HTTPS.

optional
partitioned: boolean

Indicates that the cookie should be stored using partitioned storage.