@eryx/http/cookies Module

JSON

Summary

Functions

cookies.parseCookie(setCookieStr: string, requestHost: string, requestPath: string)Cookie?
cookies.domainMatches(cookieDomain: string, requestHost: string)boolean
cookies.pathMatches(cookiePath: string, requestPath: string)boolean

API Reference

Functions

cookies.parseCookie

Parse a Set-Cookie header value into a Cookie table. requestHost and requestPath provide defaults when the cookie does not specify Domain or Path.

cookies.parseCookie(setCookieStr: string, requestHost: string, requestPath: string)Cookie?

cookies.domainMatches

Check if a cookie's domain matches the request host. Per RFC 6265 §5.1.3: exact match or host ends with ".domain".

cookies.domainMatches(cookieDomain: string, requestHost: string)boolean

cookies.pathMatches

Check if a cookie's path matches the request path. Per RFC 6265 §5.1.4.

cookies.pathMatches(cookiePath: string, requestPath: string)boolean

Types

Cookie

A single HTTP cookie with its attributes.

name: string
value: string
domain: string
path: string
expires: number?
secure: boolean
httpOnly: boolean
sameSite: string?