Class: Cookie

Read Only

Represents a Cookie.

Constructor

Initializes the http:Cookie object.

init (string name, string value, *CookieOptions options)
  • name string
  • Name of the http:Cookie

  • value string
  • Value of the http:Cookie

Methods

isPersistent

Checks the persistence of the cookie.

isValid

Checks the validity of the attributes of the cookie.

toStringValue

Gets the Cookie object in its string representation to be used in the ‘Set-Cookie’ header of the response.

Fields

  • name string
  • Name of the cookie

  • value string
  • Value of the cookie

  • path string?
  • URI path to which the cookie belongs

  • domain string?
  • Host to which the cookie will be sent

  • expires string?
  • Maximum lifetime of the cookie represented as the date and time at which the cookie expires

  • maxAge int
  • Maximum lifetime of the cookie represented as the number of seconds until the cookie expires

  • httpOnly boolean
  • Cookie is sent only to HTTP requests

  • secure boolean
  • Cookie is sent only to secure channels

  • createdTime Utc
  • At what time the cookie was created

  • lastAccessedTime Utc
  • Last-accessed time of the cookie

  • hostOnly boolean
  • Cookie is sent only to the requested host

isPersistent

function isPersistent() returns boolean
Isolated Function

Checks the persistence of the cookie.

Return Type

(boolean)

false if the cookie will be discarded at the end of the "session" or else true.

isValid

function isValid() returns boolean | InvalidCookieError
Isolated Function

Checks the validity of the attributes of the cookie.

Return Type

(boolean | InvalidCookieError)

true if the attributes of the cookie are in the correct format or else an http:InvalidCookieError

toStringValue

function toStringValue() returns string
Isolated Function

Gets the Cookie object in its string representation to be used in the ‘Set-Cookie’ header of the response.

Return Type

(string)

The string value of the ‘http:Cookie’