Taxum / @taxum/cookie / Cookie
Class: Cookie
Defined in: cookie.ts:24
Represents an HTTP cookie.
Example
import { Cookie } from "@taxum/cookie";
const cookie = new Cookie("my-cookie", "my-value");
Constructors
Constructor
new Cookie(
name
,value
,options?
):Cookie
Defined in: cookie.ts:41
Creates a new Cookie with a given name and value.
You can additionally supply any of the standard cookie options.
Parameters
name
string
value
string
= ""
options?
Returns
Cookie
Properties
domain
readonly
domain:undefined
|string
Defined in: cookie.ts:29
expires
readonly
expires:undefined
|Date
|ZonedDateTime
Defined in: cookie.ts:27
httpOnly
readonly
httpOnly:undefined
|boolean
Defined in: cookie.ts:32
maxAge
readonly
maxAge:undefined
|number
|Duration
Defined in: cookie.ts:28
name
readonly
name:string
Defined in: cookie.ts:25
partitioned
readonly
partitioned:undefined
|boolean
Defined in: cookie.ts:34
path
readonly
path:undefined
|string
Defined in: cookie.ts:30
sameSite
readonly
sameSite:undefined
|"Strict"
|"Lax"
|"None"
Defined in: cookie.ts:33
secure
readonly
secure:undefined
|boolean
Defined in: cookie.ts:31
value
readonly
value:string
Defined in: cookie.ts:26
Methods
asRemoval()
asRemoval():
Cookie
Defined in: cookie.ts:77
Converts the cookie to a removal cookie.
Returns
Cookie
encode()
encode():
string
Defined in: cookie.ts:109
Encodes the cookie for Set-Cookie
headers.
biome-ignore lint/complexity/noExcessiveCognitiveComplexity: simple enough
Returns
string
withValue()
withValue(
value
):Cookie
Defined in: cookie.ts:93
Returns a new cookie with the specified value.
Parameters
value
string
Returns
Cookie
parse()
static
parse(cookie
):null
|Cookie
Defined in: cookie.ts:57
Parses a cookie string into a Cookie
header.
Parameters
cookie
string
Returns
null
| Cookie