cookies

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cookies is responsible to read and write cookies based on a supplied configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppCookie

type AppCookie struct {
	Settings Settings
}

AppCookie is responsible for writing, reading cookies

func NewAppCookie

func NewAppCookie(c Settings) *AppCookie

NewAppCookie returns a new instance of type AppCookie

func (*AppCookie) Del

func (a *AppCookie) Del(name string, w http.ResponseWriter)

Del removes the cookie by setting MaxAge to < 0

func (*AppCookie) Get

func (a *AppCookie) Get(name string, r *http.Request) string

Get retrieves a cookie value

func (*AppCookie) Set

func (a *AppCookie) Set(name, value string, expirySec int, w http.ResponseWriter)

Set create a cookie with the given name and value and using the provided settings

type Settings

type Settings struct {
	Path   string
	Domain string
	Secure bool
	Prefix string
}

Settings defines parameters for cookies used for HTML-based errors

Jump to

Keyboard shortcuts

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