Class: Cookie

Represents a Cookie.

Constructor

Initializes the http:Cookie object.

init (string name, string value)
  • 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?(default ())
  • Name of the cookie

  • value string?(default ())
  • Value of the cookie

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

  • path string?(default ())
  • URI path to which the cookie belongs

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

  • maxAge int(default 0)
  • Maximum lifetime of the cookie represented as the number of seconds until the cookie expires

  • httpOnly boolean(default false)
  • Cookie is sent only to HTTP requests

  • secure boolean(default false)
  • Cookie is sent only to secure channels

  • createdTime Utc(default time:utcNow())
  • At what time the cookie was created

  • lastAccessedTime Utc(default time:utcNow())
  • Last-accessed time of the cookie

  • hostOnly boolean(default false)
  • 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’