parseCookies
Parses a Cookie header.
Parses a Cookie header. At most 50 cookies are read, a header over 8 KiB is ignored, names that
are not tokens are skipped, and the first occurrence of a name wins. The result is a Map, so a
cookie named __proto__ is plain data.
Import#
ts
import { parseCookies } from "@shadow-js/dusk/server";
Signature#
ts
function parseCookies(header: string | null): Map<string, string>
Parameters#
| Name | Description |
|---|---|
header |
The raw header value, or null. |
Returns#
Name to value, values percent-decoded.
Examples#
ts
parseCookies("a=1; b=hello%20world").get("b"); // "hello world"