Documentation ¶
Index ¶
- Constants
- func DumpRoutesHandler() sux.HandlerFunc
- func GenRequestID() sux.HandlerFunc
- func HTTPBasicAuth(users map[string]string) sux.HandlerFunc
- func HTTPMethodOverrideHandler(h http.Handler) http.Handler
- func IgnoreFavIcon() sux.HandlerFunc
- func PanicsHandler() sux.HandlerFunc
- func RequestLogger() sux.HandlerFunc
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 HTTPBasicAuth ¶ added in v1.0.2
func HTTPBasicAuth(users map[string]string) sux.HandlerFunc
HTTPBasicAuth for the request
func HTTPMethodOverrideHandler ¶
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:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.