Back to Pocketbase

Class Cookie

static/jsvm/classes/Cookie.html

latest2.9 KB
Original Source

Class Cookie

A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an HTTP response.

Example:

routerAdd("POST", "/example", (c) => { c.setCookie(new Cookie({ name: "example_name", value: "example_value", path: "/", domain: "example.com", maxAge: 10, secure: true, httpOnly: true, sameSite: 3, })) return c.redirect(200, "/");})Copy

Hierarchy

Implements

Index

Constructors

constructor

Methods

stringvalid

Properties

domainexpireshttpOnlymaxAgenamepartitionedpathquotedrawrawExpiressameSitesecureunparsedvalue

Constructors

constructor

  • new Cookie(options?): Cookie

Parameters

Optional options: Partial<http.Cookie>

Returns Cookie

Methods

string

  • string(): string

String returns the serialization of the cookie for use in a [Cookie] header (if only Name and Value are set) or a Set-Cookie response header (if other fields are set). If c is nil or c.Name is invalid, the empty string is returned.

Returns string

valid

  • valid(): void

Valid reports whether the cookie is valid.

Returns void

Properties

domain

domain: string

expires

expires: Time

httpOnly

httpOnly: boolean

maxAge

maxAge: number

MaxAge=0 means no 'Max-Age' attribute specified. MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0' MaxAge>0 means Max-Age attribute present and given in seconds

name

name: string

partitioned

partitioned: boolean

path

path: string

quoted

quoted: boolean

raw

raw: string

rawExpires

rawExpires: string

sameSite

sameSite: SameSite

secure

secure: boolean

unparsed

unparsed: string[]

value

value: string

Settings

Member Visibility

  • Inherited

Theme

OSLightDark

On This Page

Generated using TypeDoc