cookies

package
v0.0.0-...-82e7740 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 4 Imported by: 0

README

util-cookies GoDoc

cookie library for Go

Installation

go get gopkg.in/goyy/goyy.v0/util/cookies

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cookie(r *http.Request, name string) (*http.Cookie, error)

Cookie returns the named cookie provided in the request or http.ErrNoCookie if not found.

func Remove

func Remove(w http.ResponseWriter, r *http.Request, name string) error

Remove removes a cookie specified by name

func Reset

func Reset(w http.ResponseWriter, r *http.Request, name, value string) error

Reset reset a cookie specified by name, only modify the value property, other attributes remain unchanged.

func Set

func Set(w http.ResponseWriter, name, value, path string, expires time.Time)

Set adds a cookie to a user's browser with a name, value, path and expiry.

func SetCookie

func SetCookie(w http.ResponseWriter, cookie *http.Cookie)

SetCookie adds a Set-Cookie header to the provided ResponseWriter's headers.

func SetValue

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

SetValue adds a cookie to a user's browser with a name, value.

func SetValueExpires

func SetValueExpires(w http.ResponseWriter, name, value string, expires time.Time)

SetValueExpires adds a cookie to a user's browser with a name, value and expires.

func SetValueMaxAge

func SetValueMaxAge(w http.ResponseWriter, name, value string, maxAge int)

SetValueMaxAge adds a cookie to a user's browser with a name, value and maxAge. 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

func Value

func Value(r *http.Request, name string) (string, error)

Value returns the value of cookie by name or http.ErrNoCookie if not found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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