middleware

package
v0.0.0-...-e4d000a Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHead

func GetHead(next http.Handler) http.Handler

GetHead automatically route undefined HEAD requests to GET handlers.

func RedirectSlashes

func RedirectSlashes(next http.Handler) http.Handler

RedirectSlashes is a middleware that will match request paths with a trailing slash and redirect to the same path, less the trailing slash.

NOTE: RedirectSlashes middleware is *incompatible* with http.FileServer, see https://github.com/go-chi/chi/issues/343

func StripSlashes

func StripSlashes(next http.Handler) http.Handler

StripSlashes is a middleware that will match request paths with a trailing slash, strip it from the path and continue routing through the mux, if a route matches, then it will serve the handler.

func WithValue

func WithValue(key interface{}, val interface{}) func(next http.Handler) http.Handler

WithValue is a middleware that sets a given key/value in a context chain.

Types

This section is empty.

Jump to

Keyboard shortcuts

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