middleware

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(next http.Handler) http.Handler

func Panic

func Panic(next http.Handler) http.Handler

func PanicReportTimeoutHandler

func PanicReportTimeoutHandler(h http.Handler, dt time.Duration, msg string) http.Handler

PanicReportTimeoutHandler replaces http.TimeoutHandler with PanicReportTimeoutHandler

func RequestID

func RequestID() func(next http.Handler) http.Handler

RequestID takes X-Request-Id header value and puts it in the outgoing context. This middleware must be executed after Auth middleware as it requires a set user id field in the context.

If the request context stores a user structure, the function puts the user id before the request id to avoid collisions of the same requests id between different users.

func RequestIP

func RequestIP() func(next http.Handler) http.Handler

func Timeout

func Timeout(dt time.Duration) func(next 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