$k. NewCookie

Represents a new HTTP Cookie (RFC 2109) that can be added to a response

Constructor

new $k.NewCookie(name, value)

Creates a new cookie

Parameters:
NameTypeDescription
namestring
valuestring
Since
  • 4.0.0

Extends

Methods

comment() → {string|undefined}

Returns the comment of the cookie

Since
  • 4.0.0
Returns:
Type: 
string | undefined

domain() → {string|undefined}

Returns the domain of the cookie

Since
  • 4.0.0
Returns:
Type: 
string | undefined

expiry() → {Date|undefined}

Returns the expiry date of the cookie

Since
  • 4.0.0
Returns:
Type: 
Date | undefined

httpOnly() → {boolean}

Returns true if the cookie contains the HttpOnly attribute

Since
  • 4.0.0
Returns:
Type: 
boolean

maxAge() → {number|undefined}

Returns the maximum age of the the cookie in seconds

Since
  • 4.0.0
Returns:
Type: 
number | undefined

name() → {string}

Returns the name of the cookie

Since
  • 4.0.0
Inherited From
Returns:
Type: 
string

path() → {string|undefined}

Returns the path of the cookie

Since
  • 4.0.0
Returns:
Type: 
string | undefined

port() → {number|undefined}

Returns the port of the cookie

Since
  • 4.0.0
Returns:
Type: 
number | undefined

secureOnly() → {boolean}

Returns true if the cookie will only be sent over a secure connection

Since
  • 4.0.0
Returns:
Type: 
boolean

setComment(comment)

Sets the comment of the cookie

Parameters:
NameTypeDescription
commentstring
Since
  • 4.0.0

setDomain(domain)

Sets the domain of the cookie

Parameters:
NameTypeDescription
domainstring
Since
  • 4.0.0

setExpiry(expiryDate)

Sets the expiry date of the cookie

Parameters:
NameTypeDescription
expiryDateDate
Since
  • 4.0.0

setHttpOnly(httpOnlyopt)

Set the HttpOnly attribute

Parameters:
NameTypeAttributesDefaultDescription
httpOnlyboolean<optional>
true

True if undefined

Since
  • 4.0.0

setMaxAge(maxAge)

Sets the maximum age of the the cookie in seconds

Parameters:
NameTypeDescription
maxAgenumber
Since
  • 4.0.0

setPath(path)

Sets the path of the cookie

Parameters:
NameTypeDescription
pathstring
Since
  • 4.0.0

setPort(port)

Sets the port of the cookie

Parameters:
NameTypeDescription
portnumber
Since
  • 4.0.0

setSecureOnly(secureOnlyopt)

Set if the cookie will only be sent over a secure connection

Parameters:
NameTypeAttributesDefaultDescription
secureOnlyboolean<optional>
true

True if undefined

Since
  • 4.0.0

setVersion(version)

Sets the version of the cookie

Parameters:
NameTypeDescription
versionnumber
Since
  • 4.0.0
Deprecated
  • This function is deprecated and might be removed in future releases

value() → {string}

Returns the value of the cookie

Since
  • 4.0.0
Inherited From
Returns:
Type: 
string

version() → {number|undefined}

Returns the version of the cookie

Since
  • 4.0.0
Deprecated
  • This function is deprecated and might be removed in future releases
Returns:
Type: 
number | undefined