middlewares

package
v0.0.0-...-c4a3ebf Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonResponse

func JsonResponse(next http.Handler) http.Handler

JsonResponse sets the response content-type header to application/json; charset=utf-8

func NewStatusMiddleware

func NewStatusMiddleware(next http.Handler) http.Handler

func RequestIDHandler

func RequestIDHandler(h http.Handler) http.Handler

RequestIDHandler sets unique request id. If header `X-Request-ID` is already present in the request, that is considered the request id. Otherwise, generates a new unique ID.

func RequestLogWrapper

func RequestLogWrapper(next http.Handler) http.Handler

RequestLogWrapper adds a zerolog.Loggger to the request context, set http specific log fields and at the end of the request logs the request details and its duration in ms

func TimeoutWrapper

func TimeoutWrapper(timeout time.Duration) func(handler http.Handler) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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