Parses cookies from a Cookie request header into a name→value record.
Delegates to the canonical codec in @setu-ts/common, so the
framework has exactly one cookie parser (AI_GUIDELINES §11.1). That codec is
stricter than this function's original inline implementation in three ways,
each a defect fix rather than a feature: values are percent-decoded (so a
cookie written by any standards-compliant server round-trips), one layer of
RFC 6265 quoting is removed, and a repeated cookie name resolves to the first
occurrence rather than the last (browsers send the most specific cookie
first). See the CHANGELOG entry for 0.2.0.
Parameters
headers: Headers
Request headers
Returns Record<string,string>
Parsed cookies (empty when no Cookie header is present)
Parses cookies from a
Cookierequest header into a name→value record.Delegates to the canonical codec in
@setu-ts/common, so the framework has exactly one cookie parser (AI_GUIDELINES §11.1). That codec is stricter than this function's original inline implementation in three ways, each a defect fix rather than a feature: values are percent-decoded (so a cookie written by any standards-compliant server round-trips), one layer of RFC 6265 quoting is removed, and a repeated cookie name resolves to the first occurrence rather than the last (browsers send the most specific cookie first). See the CHANGELOG entry for0.2.0.