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

RequestCookieStore

import { RequestCookieStore } from "https://raw.githubusercontent.com/worker-tools/shed/master/index.ts";

An implementation of the Cookie Store API for request handlers.

It uses the Cookie header of a request to populate the store and keeps a record of changes that can be exported as a list of Set-Cookie headers.

Note that this is not a polyfill! It is intended as a cookie middleware for Cloudflare Workers, and perhaps some other uses.

class RequestCookieStore implements CookieStore {
constructor(request: Request);
get headers(): [string, string][];
 
addEventListener(
_type: string,
_listener: EventListenerOrEventListenerObject,
_options?: boolean | AddEventListenerOptions,
): void;
delete(name: string): Promise<void>;
delete(options: CookieStoreDeleteOptions): Promise<void>;
delete(options: string | CookieStoreDeleteOptions): Promise<void>;
dispatchEvent(_event: Event): boolean;
get(name?: string): Promise<CookieListItem | null>;
get(options?: CookieStoreGetOptions): Promise<CookieListItem | null>;
get(options?: string | CookieStoreGetOptions): Promise<CookieListItem | null>;
getAll(name?: string): Promise<CookieList>;
getAll(options?: CookieStoreGetOptions): Promise<CookieList>;
getAll(options?: string | CookieStoreGetOptions): Promise<CookieList>;
removeEventListener(
_type: string,
_callback: EventListenerOrEventListenerObject,
_options?: boolean | EventListenerOptions,
): void;
set(name: string, value: string): Promise<void>;
set(options: CookieInit): Promise<void>;
set(options: string | CookieInit, value?: string): Promise<void>;
toCookieString();
 
static toSetCookie(cookie: CookieInit): string;
}

§Implements

§Constructors

§
new RequestCookieStore(request: Request)
[src]

§Properties

§
headers: [string, string][] readonly
[src]

Exports the recorded changes to this store as a list of Set-Cookie headers.

Can be passed as the headers field when building a new Response:

new Response(body, { headers: cookieStore.headers }) 

§Methods

§
addEventListener(_type: string, _listener: EventListenerOrEventListenerObject, _options?: boolean | AddEventListenerOptions): void
[src]
§
delete(name: string): Promise<void>
[src]
delete(options: CookieStoreDeleteOptions): Promise<void>
[src]
delete(options: string | CookieStoreDeleteOptions): Promise<void>
[src]
§
dispatchEvent(_event: Event): boolean
[src]
§
get(name?: string): Promise<CookieListItem | null>
[src]
get(options?: CookieStoreGetOptions): Promise<CookieListItem | null>
[src]
get(options?: string | CookieStoreGetOptions): Promise<CookieListItem | null>
[src]
§
getAll(name?: string): Promise<CookieList>
[src]
getAll(options?: CookieStoreGetOptions): Promise<CookieList>
[src]
getAll(options?: string | CookieStoreGetOptions): Promise<CookieList>
[src]
§
removeEventListener(_type: string, _callback: EventListenerOrEventListenerObject, _options?: boolean | EventListenerOptions): void
[src]
§
set(name: string, value: string): Promise<void>
[src]
set(options: CookieInit): Promise<void>
[src]
set(options: string | CookieInit, value?: string): Promise<void>
[src]
§
toCookieString()
[src]

Exports the entire cookie store as a cookie header string

§Static Methods

§
toSetCookie(cookie: CookieInit): string deprecated
[src]

Helper to turn a single CookieInit into a set-cookie string.

@deprecated

Might remove/change name