cookie

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(w http.ResponseWriter, name string)

func Get

func Get(r *http.Request, key string) *http.Cookie

func GetCryptoCookie added in v1.4.1

func GetCryptoCookie(req *http.Request, k string) string

func GetValue

func GetValue(r *http.Request, key string) string

func Set

func Set(w http.ResponseWriter, name, value string)

func SetCodec added in v1.4.1

func SetCodec(ck, hashKey, blockKey []byte)

func SetCryptoCookie added in v1.4.1

func SetCryptoCookie(w http.ResponseWriter, key, value string, maxAge int) (err error)

func SetWithExpires

func SetWithExpires(w http.ResponseWriter, name, value string, expires int64)

Types

type Optionals

type Optionals struct {
	Path       string    // optional
	Domain     string    // optional
	Expires    time.Time // optional
	RawExpires string    // for reading cookies only

	// 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 http.SameSite
}

Jump to

Keyboard shortcuts

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