middleware

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2018 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIErrHandler

func APIErrHandler(defaultErr error, logger *zerolog.Logger, render render.Render) func(http.Handler) http.Handler

APIErrHandler intercept responses to verify if his status code is >= 500. If status is >= 500, it'll response with a default error. This middleware allows to response with the same error without disclosure internal information, also the real error is logged.

func LoggerRequest

func LoggerRequest(extraLog bool) []func(next http.Handler) http.Handler

LoggerRequest some provided extra handler to set some request's context fields.

func Recovery

func Recovery(logger *zerolog.Logger, render render.Render) func(http.Handler) http.Handler

Recovery is a middleware that recovers from panics, logs the panic (and a backtrace), and returns a HTTP 500 (Internal Server Error) status if possible. Recovery prints a request ID if one is provided.

Types

This section is empty.

Jump to

Keyboard shortcuts

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