middleware

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package middleware provides the collection of processing filters for the http request.

Index

Constants

View Source
const (
	// the name of CSRF cookie
	CsrfCookieName = "csrf_token"
)

Variables

This section is empty.

Functions

func AccessLogMiddleware

func AccessLogMiddleware(
	apiUrlPrefix string,
	logWriter io.WriteCloser,
	templateRenderer eighty.PageRenderer,
	logger logging.Logger) (handler routing.Middleware, closer func(), err error)

AccessLogMiddleware returns a routing.Middleware that handles error handling and access logging.

func CSRFFunc

func CSRFFunc(isDebug bool, expire time.Duration, secure bool) (w routing.Middleware)

CSRFFunc returns a routing.Middleware that handles CSRF validation logic.

func CSRFToken

func CSRFToken(ctx *fasthttp.RequestCtx) (token string)

CSRFToken returns a CSRF token in the current request context. If the token was not found in the request, zero-value returned.

func CacheControlFunc

func CacheControlFunc(debug bool, startupTime time.Time) func(next http.Handler) http.Handler

CacheControlFunc returns a func(next http.Handler) http.Handler that handles cache control header.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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