UNPKG

@taxum/cookie

Version:
24 lines (23 loc) 700 B
import type { Extractor } from "@taxum/core/extract"; import { CookieJar } from "./jar.js"; /** * Extractor that grabs cookies from the request and returns a * {@link CookieJar}. * * When making modifications to the cookie jar, you need to return the jar * in the response. Any modified or removed cookies will yield a `Set-Cookie` * header in the response. * * @example * ```ts * import { cookieJar, Cookie } from "@taxum/cookie"; * import { extractHandler } from "@taxum/core/routing"; * * const handler = extractHandler(cookieJar, (jar) => { * jar.add(new Cookie("foo", "bar")); * * return [jar, ""]; * }); * ``` */ export declare const cookieJar: Extractor<CookieJar>;