Help us shape the future of Go! Take the 2026 Go Developer Survey

middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestIDKey    contextKey = "requestId"
	RequestIDHeader string     = "X-Request-Id"
)

Variables

This section is empty.

Functions

func PanicRecover

func PanicRecover(next http.Handler) http.Handler

Types

type RequestIdConfig

type RequestIdConfig struct {
	AcceptFromHeader bool
}

RequestIdConfig is the configuration for the request ID middleware

func (*RequestIdConfig) RequestID

func (c *RequestIdConfig) RequestID(next http.Handler) http.Handler

RequestID middleware that adds a request ID to the context of the request

type RequestLoggerConfig

type RequestLoggerConfig struct {
	LogRequestBody bool
}

RequestLoggerConfig is a middleware that logs the incoming requests.

func (*RequestLoggerConfig) LogRequests

func (rl *RequestLoggerConfig) LogRequests(next http.Handler) http.Handler

LogRequests logs the incoming requests.

Jump to

Keyboard shortcuts

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