tough-cookie.parse.md

August 1, 2025 ยท View on GitHub

Home > tough-cookie > parse

parse() function

Parses a string into a Cookie object.

Signature:

declare function parse(str: string, options?: ParseCookieOptions): Cookie | undefined;

Parameters

Parameter

Type

Description

str

string

The Set-Cookie header or a Cookie string to parse.

options

ParseCookieOptions

(Optional) Configures strict or loose mode for cookie parsing

Returns:

Cookie | undefined

Remarks

Note: when parsing a Cookie header it must be split by ';' before each Cookie string can be parsed.