Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAfter ¶
func DefaultAfter(res negroni.ResponseWriter, latency time.Duration, msg string)
DefaultAfter -- is the default func assigned to *Middleware.After
func DefaultBefore ¶
DefaultBefore is the default func assigned to *Middleware.Before
Types ¶
type AfterFunc ¶
type AfterFunc func(negroni.ResponseWriter, time.Duration, string)
AfterFunc is the func type used to modify or replace the *logrus.Entry after calling the next func in the middleware chain
type BeforeFunc ¶
BeforeFunc is the func type used to modify or replace the *logrus.Entry prior to calling the next func in the middleware chain
type CorsMiddleware ¶
type CorsMiddleware struct { }
CorsMiddleware is a middleware handler that support CORS response header
func NewCorsMiddleware ¶
func NewCorsMiddleware() *CorsMiddleware
NewCorsMiddleware returns a new *Middleware which writes to a given logger.
func (*CorsMiddleware) ServeHTTP ¶
func (m *CorsMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP --
type HttpLogMiddleware ¶
type HttpLogMiddleware struct { Before BeforeFunc After AfterFunc // contains filtered or unexported fields }
HttpLogMiddleware is a middleware handler that logs the request as it goes in and the response as it goes out.
func NewHttpLogMiddleware ¶
func NewHttpLogMiddleware() *HttpLogMiddleware
NewHttpLogMiddleware returns a new *Middleware which writes to a given logger.
func (*HttpLogMiddleware) ExcludeURL ¶
func (m *HttpLogMiddleware) ExcludeURL(u string) error
ExcludeURL -- adds a new URL u to be ignored during logging. The URL u is parsed, hence the returned error
func (*HttpLogMiddleware) ExcludedURLs ¶
func (m *HttpLogMiddleware) ExcludedURLs() []string
ExcludedURLs -- returns the list of excluded URLs for this middleware
func (*HttpLogMiddleware) ServeHTTP ¶
func (m *HttpLogMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP --
type PreFlightMiddleware ¶
type PreFlightMiddleware struct { }
PreFlightMiddleware is a middleware handler that support pre-flight OPTIONS request
func NewPreFlightMiddleware ¶
func NewPreFlightMiddleware() *PreFlightMiddleware
NewPreFlightMiddleware returns a new *Middleware which writes to a given logger.
func (*PreFlightMiddleware) ServeHTTP ¶
func (m *PreFlightMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP --
type RecoveryMiddleware ¶
type RecoveryMiddleware struct { PrintStack bool StackAll bool StackSize int Formatter negroni.PanicFormatter }
RecoveryMiddleware is a middleware that recovers from any panics and writes a 500 if there was one.
func NewRecoveryMiddleware ¶
func NewRecoveryMiddleware(printStack bool) *RecoveryMiddleware
func (*RecoveryMiddleware) ServeHTTP ¶
func (m *RecoveryMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP --
type TimeoutMiddleware ¶
type TimeoutMiddleware struct {
// contains filtered or unexported fields
}
TimeoutMiddleware is a middleware handler that support CORS response header
func NewTimeoutMiddleware ¶
func NewTimeoutMiddleware(timeout time.Duration) *TimeoutMiddleware
NewTimeoutMiddleware returns a new *Middleware which writes to a given logger.
func (*TimeoutMiddleware) ServeHTTP ¶
func (m *TimeoutMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
ServeHTTP --