cookie

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cookie struct {
	// Name is the name of the cookie.
	Name string

	// Path is path of the cookie.
	Path string

	// MaxAge is the max age of the cookie.
	MaxAge time.Duration

	// HTTPOnly restricts the cookie to HTTP (no javascript access).
	HTTPOnly bool
}

Cookie is a description of a cookie used for consistent cookie setting and deleting.

func (*Cookie) Exists

func (d *Cookie) Exists(r *http.Request) bool

Exists checks if the cookies exists.

func (*Cookie) Get

func (d *Cookie) Get(w http.ResponseWriter, r *http.Request, v interface{}) (bool, error)

Get decodes the cookie into the value. Returns false if the cookie is not there.

func (*Cookie) Remove

func (d *Cookie) Remove(w http.ResponseWriter, r *http.Request)

Remove the cookie with the specified name (if it exists).

func (*Cookie) Set

func (d *Cookie) Set(w http.ResponseWriter, r *http.Request, v interface{}) error

Set the value of the cookie.

Jump to

Keyboard shortcuts

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