Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScopeAndDuration ¶
ScopeAndDuration represents the scope and duration settings for cookies.
func (ScopeAndDuration) Cookie ¶
func (d ScopeAndDuration) Cookie(value string) *http.Cookie
Cookie returns a new http.Cookie with the specified value and the scope and duration settings from the ScopeAndDuration receiver.
func (ScopeAndDuration) SetDefaults ¶
func (d ScopeAndDuration) SetDefaults(domain, path string, duration time.Duration) ScopeAndDuration
SetDefaults uses the supplied values as defaults for ScopeAndDuration if the current values are not already set.
type Secure ¶
type Secure string
Secure represents a named cookie that is set 'securely'. It is primarily intended to document and track the use of cookies in a web application.
func (Secure) Read ¶
Read reads the cookie from the request and returns its value. If the cookie is not present, it returns an empty string and false.
func (Secure) ReadAndClear ¶
ReadAndClear reads a cookie and requests its removal by setting its MaxAge to -1 and its value to an empty string.
func (Secure) Set ¶
func (c Secure) Set(rw http.ResponseWriter, ck *http.Cookie)
Set sets the supplied cookie securely with the name of the cookie specified in the receiver and secure values for HttpOnly, Secure and SameSite (true, true, SameSiteStrictMode). All other fields in ck are used as specified.
type T ¶
type T string
T represents a named cookie. It is primarily intended to document and track the use of cookies in a web application.
func (T) Read ¶
Read reads the cookie from the request and returns its value. If the cookie is not present, it returns an empty string and false.
func (T) ReadAndClear ¶
ReadAndClear reads a cookie and requests its removal by setting its MaxAge to -1 and its value to an empty string.