handlers

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	// HTTPMethodOverrideHeader is a commonly used http header to override a request method.
	HTTPMethodOverrideHeader = "X-HTTP-Method-Override"
	// HTTPMethodOverrideFormKey is a commonly used HTML form key to override a request method.
	HTTPMethodOverrideFormKey = "_method"
)
View Source
const FavIcon = "/favicon.ico"

FavIcon uri for favicon.ico

Variables

This section is empty.

Functions

func DumpRoutesHandler

func DumpRoutesHandler() sux.HandlerFunc

DumpRoutesHandler

func GenRequestID

func GenRequestID() sux.HandlerFunc

GenRequestID for the request

func HTTPBasicAuth added in v1.0.2

func HTTPBasicAuth(users map[string]string) sux.HandlerFunc

HTTPBasicAuth for the request

func HTTPMethodOverrideHandler

func HTTPMethodOverrideHandler(h http.Handler) http.Handler

HTTPMethodOverrideHandler wraps and returns a http.Handler which checks for the X-HTTP-Method-Override header or the _method form key, and overrides (if valid) request.Method with its value.

It is ref from the https://github.com/gorilla/handlers

Example
r := sux.New()

h := HTTPMethodOverrideHandler(r)
http.ListenAndServe(":8080", h)

// can also:
h1 := r.WrapHttpHandlers(HTTPMethodOverrideHandler)
http.ListenAndServe(":8080", h1)
Output:

func IgnoreFavIcon added in v1.0.2

func IgnoreFavIcon() sux.HandlerFunc

IgnoreFavIcon middleware

func PanicsHandler

func PanicsHandler() sux.HandlerFunc

PanicsHandler middleware

func RequestLogger

func RequestLogger() sux.HandlerFunc

RequestLogger middleware

Types

This section is empty.

Jump to

Keyboard shortcuts

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