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>;
dispatchEvent(_event: Event): boolean;
removeEventListener(
_type: string,
_callback: EventListenerOrEventListenerObject,
_options?: boolean | EventListenerOptions,
): void;set(name: string, value: string): Promise<void>;
toCookieString();
§Implements
§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]§
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]