Documentation ¶
Overview ¶
Package middleware provices standard http middleware modules
Index ¶
- func AcceptMiddleware(supported ...string) func(http.Handler) http.Handler
- func NOOP(next http.Handler) http.Handler
- func NewHTTPSRedirectHandler(port int) http.Handler
- func WithErrorHandler(ctx context.Context, eh ErrorHandlerFunc) context.Context
- func WithErrorHandlerMiddleware(eh ErrorHandlerFunc) func(http.Handler) http.Handler
- type ErrorHandlerFunc
- type HTTPSRedirectHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptMiddleware ¶ added in v0.2.1
AcceptMiddleware filters the Accept header to only include those
func NewHTTPSRedirectHandler ¶
NewHTTPSRedirectHandler creates a new automatic redirect to HTTPS handler
func WithErrorHandler ¶
func WithErrorHandler(ctx context.Context, eh ErrorHandlerFunc) context.Context
WithErrorHandler attaches an ErrorHandler function to a context for later retrieval
func WithErrorHandlerMiddleware ¶
func WithErrorHandlerMiddleware(eh ErrorHandlerFunc) func(http.Handler) http.Handler
WithErrorHandlerMiddleware returns a middleware that attaches a given ErrorHandler to their contexts
Types ¶
type ErrorHandlerFunc ¶
type ErrorHandlerFunc = web.ErrorHandlerFunc
ErrorHandlerFunc is the signature of a function used as ErrorHandler
func ErrorHandler ¶
func ErrorHandler(ctx context.Context) (ErrorHandlerFunc, bool)
ErrorHandler attempts to pull an ErrorHandler from the context.Context
type HTTPSRedirectHandler ¶
type HTTPSRedirectHandler struct {
Port int
}
HTTPSRedirectHandler provides an automatic redirect to HTTPS
func (*HTTPSRedirectHandler) ServeHTTP ¶
func (h *HTTPSRedirectHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.