middleware

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHTTPRecovered = errors.DefineInternal("http_recovered", "Internal Server Error")

ErrHTTPRecovered is returned when a panic is caught from an HTTP handler.

Functions

func FillContext

func FillContext(fillers ...fillcontext.Filler) echo.MiddlewareFunc

FillContext fills the request context by executing the given fillers.

func ID

func ID(prefix string) echo.MiddlewareFunc

ID adds a request id to the request.

func Log

func Log(logger log.Interface) echo.MiddlewareFunc

Log is middleware that logs the request.

func Noop

func Noop(next echo.HandlerFunc) echo.HandlerFunc

Noop is middleware that does nothing.

func Normalize

func Normalize(mode NormalizationMode) echo.MiddlewareFunc

Normalize is middleware that normalizes the url and redirects the request if necessary.

func Recover

func Recover() echo.MiddlewareFunc

Recover returns Echo middleware that recovers from panics.

Types

type NormalizationMode

type NormalizationMode int

NormalizationMode describes how to normalize the request url.

const (
	// Ignore is the normalization mode where no action is taken.
	Ignore NormalizationMode = iota

	// RedirectPermanent is the normalization mode where the client is redirected with 301 or 308.
	RedirectPermanent

	// RedirectTemporary is the normalization mode where the client is redirected with 302 or 307.
	RedirectTemporary

	// Continue is the normalization mode where the request url is updated but the request can just be handled.
	Continue
)

Jump to

Keyboard shortcuts

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