UNPKG

@prostory/mountain

Version:

Yet another HTTP/2 server and client.

27 lines (26 loc) 923 B
export interface Attributes { readonly Path?: string; readonly Domain?: string; readonly Secure?: boolean; readonly Expires?: string; readonly HttpOnly?: boolean; readonly SameSite?: 'Strict' | 'Lax' | 'None'; readonly 'Max-Age'?: number | string; } export declare type Cookies = Attributes & { [key: string]: string | boolean; }; /** Parses cookies from headers to JavaScript object. */ export declare const parse: (data: string) => Cookies; /** * Creates cookie string from key/value pair * and optional _attributes_ object. * * By default, `Path` attribute is set to **\/** URL. * That means all requests to server will include that cookie. * It is recommended to set `Path` attribute manually. * * Also by default `Secure`, `HttpOnly` and `SameSite=Strict` * attributes are defined. */ export declare const create: (key: string, value: string, attributes?: Cookies) => string;