Cookie interface

Http response cookie object to "Set-Cookie"

Properties

domain

Specifies allowed hosts to receive the cookie

expires

NOTE: It is generally recommended that you use maxAge over expires. Sets the cookie to expire at a specific date instead of when the client closes. This can be a Javascript Date or Unix time in milliseconds.

httpOnly

Sets the cookie to be inaccessible to JavaScript's Document.cookie API

maxAge

Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately.

name
path

Specifies URL path that must exist in the requested URL

sameSite

Can restrict the cookie to not be sent with cross-site requests

secure

Sets the cookie to only be sent with an encrypted request

value

Property Details

Specifies allowed hosts to receive the cookie

domain?: string

Property Value

string

NOTE: It is generally recommended that you use maxAge over expires. Sets the cookie to expire at a specific date instead of when the client closes. This can be a Javascript Date or Unix time in milliseconds.

expires?: number | Date

Property Value

number | Date

Sets the cookie to be inaccessible to JavaScript's Document.cookie API

httpOnly?: boolean

Property Value

boolean

Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately.

maxAge?: number

Property Value

number

name: string

Property Value

string

Specifies URL path that must exist in the requested URL

path?: string

Property Value

string

Can restrict the cookie to not be sent with cross-site requests

sameSite?: "Strict" | "Lax" | "None"

Property Value

"Strict" | "Lax" | "None"

Sets the cookie to only be sent with an encrypted request

secure?: boolean

Property Value

boolean

value: string

Property Value

string