Skip to content

Latest commit

 

History

History
306 lines (132 loc) · 5.32 KB

tough-cookie.createcookieoptions.md

File metadata and controls

306 lines (132 loc) · 5.32 KB

Home > tough-cookie > CreateCookieOptions

CreateCookieOptions interface

Configurable values that can be set when creating a Cookie.

Signature:

export interface CreateCookieOptions 

Properties

Property

Modifiers

Type

Description

creation?

Date | 'Infinity' | null

(Optional) Set to the date and time when a Cookie is initially stored or a matching cookie is received that replaces an existing cookie (See RFC6265 Section 5.3).

Also used to maintain ordering among cookies. Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times (See RFC6265 Section 5.4).

domain?

string | null

(Optional) The 'Domain' attribute of the cookie represents the domain the cookie belongs to (See RFC6265 Section 5.2.3).

expires?

Date | 'Infinity' | null

(Optional) The 'Expires' attribute of the cookie (See RFC6265 Section 5.2.1).

extensions?

string[] | null

(Optional) Contains attributes which are not part of the defined spec but match the extension-av syntax defined in Section 4.1.1 of RFC6265 (See RFC6265 Section 4.1.1).

hostOnly?

boolean | null

(Optional) A boolean flag indicating if a cookie is a host-only cookie (i.e.; when the request's host exactly matches the domain of the cookie) or not (See RFC6265 Section 5.3).

httpOnly?

boolean

(Optional) The 'HttpOnly' flag of the cookie indicates if the cookie is inaccessible to client scripts or not (See RFC6265 Section 5.2.6).

key?

string

(Optional) The name or key of the cookie

lastAccessed?

Date | 'Infinity' | null

(Optional) Set to the date and time when a cookie was initially stored (RFC6265 Section 5.3) and updated whenever the cookie is retrieved from the CookieJar (RFC6265 Section 5.4).

maxAge?

number | 'Infinity' | '-Infinity' | null

(Optional) The 'Max-Age' attribute of the cookie (See RFC6265 Section 5.2.2).

path?

string | null

(Optional) The 'Path' attribute of the cookie represents the path of the cookie (See RFC6265 Section 5.2.4).

pathIsDefault?

boolean | null

(Optional) A boolean flag indicating if a cookie had no 'Path' attribute and the default path was used (See RFC6265 Section 5.2.4).

sameSite?

string | undefined

(Optional) The 'SameSite' attribute of a cookie as defined in RFC6265bis (See RFC6265bis (v13) Section 5.2).

secure?

boolean

(Optional) The 'Secure' flag of the cookie indicates if the scope of the cookie is limited to secure channels (e.g.; HTTPS) or not (See RFC6265 Section 5.2.5).

value?

string

(Optional) The value of the cookie