Skip to main content
Module

x/mandarinets/deps.ts>Cookies

Mandarine.TS is a typescript, decorator-driven framework that allows you to create server-side applications. Mandarine.TS provides a range of built-in solutions such as Dependency Injection, Components, ORM and more. Under its umbrella, Mandarine.TS has 4 modules: Core, Data, Security and MVC, these modules will offer you the requirements to build a Mandarine-powered application.
Latest
class Cookies
import { Cookies } from "https://deno.land/x/mandarinets@v2.3.2/deps.ts";

An interface which allows setting and accessing cookies related to both the current request and response.

Constructors

new
Cookies(
request: Request,
response: Response,
options?: CookiesOptions,
)

Methods

delete(name: string, options?: CookiesSetDeleteOptions): boolean

Set a cookie to be deleted in the response. This is a "shortcut" to .set(name, null, options?).

entries(): IterableIterator<[string, string]>

Iterate over the request's cookies, yielding up a tuple containing the key and the value.

If there are keys set on the application, only keys and values that are properly signed will be returned.

forEach(callback: (
key: string,
value: string,
cookies: this,
) => void
, thisArg?: any
): void
get(name: string, options?: CookiesGetOptions): string | undefined

Get the value of a cookie from the request.

If the cookie is signed, and the signature is invalid, the cookie will be set to be deleted in the the response. If the signature uses an "old" key, the cookie will be re-signed with the current key and be added to the response to be updated.

keys(): IterableIterator<string>

Iterate over the request's cookies, yielding up the keys.

If there are keys set on the application, only the keys that are properly signed will be returned.

set(
name: string,
value: string | null,
options?: CookiesSetDeleteOptions,
): this

Set a cookie in the response.

If there are keys set in the application, cookies will be automatically signed, unless overridden by the set options. Cookies can be deleted by setting the value to null.

values(): IterableIterator<string>

Iterate over the request's cookies, yielding up each value.

If there are keys set on the application, only the values that are properly signed will be returned.

[Symbol.iterator](): IterableIterator<[string, string]>

Iterate over the request's cookies, yielding up a tuple containing the key and the value.

If there are keys set on the application, only keys and values that are properly signed will be returned.