Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
LogFailed middleware logs each HTTP request method, path, response code and duration for non-2xx HTTP requests.
Logging middleware logs each HTTP request method, path, response code and duration for all HTTP requests.
Functions ¶
Types ¶
type ErrorHandler ¶ added in v1.1.0
ErrorHandler lets you call an alternate http handler upon a certain response code. Note it will assume a 200 if the wrapped handler does not write anything
type Func ¶
Func is to Interface as http.HandlerFunc is to http.Handler
type Instrument ¶
type Instrument struct {
RouteMatcher interface {
Match(*http.Request, *mux.RouteMatch) bool
}
Duration *prometheus.HistogramVec
}
Instrument is a Middleware which records timings for every HTTP request
type Interface ¶
Interface is the shared contract for all middlesware, and allows middlesware to wrap handlers.
Identity is an Interface which doesn't do anything.
func Merge ¶
Merge produces a middleware that applies multiple middlesware in turn; ie Merge(f,g,h).Wrap(handler) == f.Wrap(g.Wrap(h.Wrap(handler)))
func PathReplace ¶ added in v0.15.0
PathReplace replcase Request.RequestURI with the specified string.
Source Files
¶
- errorhandler.go
- instrument.go
- logging.go
- middleware.go
- path_rewrite.go