cookies

package
v1.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2022 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	MaxAgeNotSet = 0
)

Variables

View Source
var GlobalJar = NewCookieJar()

Functions

func SetDOMCookie

func SetDOMCookie(name, value string)

Types

type Cookie struct {
	Name  string
	Value string

	Path    string
	Domain  string
	Expires time.Time

	// 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
	MaxAge              int
	Secure              bool
	HttpOnly            bool
	SameSite            SameSite
	Raw                 string
	CalledCloseToExpire bool
}

func GetDOMCookie

func GetDOMCookie(name string) (*Cookie, error)

func (*Cookie) IsValid

func (c *Cookie) IsValid() bool

func (*Cookie) String

func (c *Cookie) String() string

type CookieJar

type CookieJar struct {
	OnExpire                 func(cookie *Cookie)
	CloseToExpire            func(cookie *Cookie)
	CloseToExpireTimeSeconds int
	// contains filtered or unexported fields
}

func NewCookieJar

func NewCookieJar() *CookieJar

func (*CookieJar) All

func (cj *CookieJar) All() []*Cookie

func (*CookieJar) AsJson added in v1.8.5

func (cj *CookieJar) AsJson(cookies ...string) ([]byte, error)

func (*CookieJar) AsMap added in v1.8.5

func (cj *CookieJar) AsMap(cookies ...string) map[string]string

func (*CookieJar) DelCookie

func (cj *CookieJar) DelCookie(name string) error

func (*CookieJar) DelCookieIndex

func (cj *CookieJar) DelCookieIndex(index int) error

func (*CookieJar) Dump added in v1.8.5

func (cj *CookieJar) Dump(r *http.Request, cookies ...string) error

func (*CookieJar) DumpForm added in v1.8.5

func (cj *CookieJar) DumpForm(rq *http.Request, cookies ...string)

func (*CookieJar) DumpJson added in v1.8.5

func (cj *CookieJar) DumpJson(rq *http.Request, cookies ...string) error

func (*CookieJar) Get

func (cj *CookieJar) Get(name string) (*Cookie, error)

func (*CookieJar) SetCookie

func (cj *CookieJar) SetCookie(cookie *Cookie) error

func (*CookieJar) SetHTTPCookie

func (cj *CookieJar) SetHTTPCookie(cookie *http.Cookie) error

func (*CookieJar) SetHTTPCookies

func (cj *CookieJar) SetHTTPCookies(cookies []*http.Cookie) error

func (*CookieJar) Stop

func (cj *CookieJar) Stop()

type SameSite

type SameSite int
const (
	SameSiteDefaultMode SameSite = iota + 1
	SameSiteLaxMode
	SameSiteStrictMode
	SameSiteNoneMode
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL