Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Cookies

import { Cookies } from "https://raw.githubusercontent.com/mandarineorg/mandarinets/master/deps.ts";

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

class Cookies {
constructor(
request: Request,
response: Response,
options?: CookiesOptions,
);
delete(name: string, options?: CookiesSetDeleteOptions): boolean;
*entries(): IterableIterator<[string, string]>;
forEach(callback: (
key: string,
value: string,
cookies: this,
) => void
, thisArg?: any): void;
get(name: string, options?: CookiesGetOptions): string | undefined;
*keys(): IterableIterator<string>;
set(
name: string,
value: string | null,
options?: CookiesSetDeleteOptions,
): this;
*values(): IterableIterator<string>;
*[Symbol.iterator](): IterableIterator<[string, string]>;
}

§Constructors

§
new Cookies(request: Request, response: Response, options?: CookiesOptions)
[src]

§Methods

§
delete(name: string, options?: CookiesSetDeleteOptions): boolean
[src]

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

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

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
[src]
§
get(name: string, options?: CookiesGetOptions): string | undefined
[src]

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>
[src]

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
[src]

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>
[src]

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]>
[src]

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.