$k. NewCookie

new NewCookie(name, value)

Creates a new cookie

Parameters:
NameTypeDescription
namestring
valuestring

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

Extends

Methods

comment() → {string}

Returns the comment of the cookie

Returns:
Type: 
string

domain() → {string}

Returns the domain of the cookie

Returns:
Type: 
string

expiry() → {date}

Returns the expiry date of the cookie

Returns:
Type: 
date

httpOnly() → {boolean}

Returns true if the cookie contains the HttpOnly attribute

Returns:
Type: 
boolean

maxAge() → {number}

Returns the maximum age of the the cookie in seconds

Returns:
Type: 
number

name() → {string}

Returns the name of the cookie

Inherited From
Returns:
Type: 
string

path() → {string}

Returns the path of the cookie

Returns:
Type: 
string

port() → {number}

Returns the port of the cookie

Returns:
Type: 
number

secureOnly() → {boolean}

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

Returns:
Type: 
boolean

setComment(comment)

Sets the comment of the cookie

Parameters:
NameTypeDescription
commentstring

setDomain(domain)

Sets the domain of the cookie

Parameters:
NameTypeDescription
domainstring

setExpiry(expiryDate)

Sets the expiry date of the cookie

Parameters:
NameTypeDescription
expiryDatedate

setHttpOnly(httpOnlyopt)

Set the HttpOnly attribute

Parameters:
NameTypeAttributesDescription
httpOnlyboolean<optional>

True if undefined

setMaxAge(maxAge)

Sets the maximum age of the the cookie in seconds

Parameters:
NameTypeDescription
maxAgenumber

setPath(path)

Sets the path of the cookie

Parameters:
NameTypeDescription
pathstring

setPort(port)

Sets the port of the cookie

Parameters:
NameTypeDescription
portnumber

setSecureOnly(secureOnlyopt)

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

Parameters:
NameTypeAttributesDescription
secureOnlyboolean<optional>

True if undefined

setVersion(version)

Sets the version of the cookie

Parameters:
NameTypeDescription
versionnumber

value() → {string}

Returns the value of the cookie

Inherited From
Returns:
Type: 
string

version() → {number}

Returns the version of the cookie

Returns:
Type: 
number