middleware

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func LogRequests added in v0.3.0

func LogRequests(next http.Handler) http.Handler

LogRequests logs the incoming requests

func PanicRecovery added in v0.3.0

func PanicRecovery(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 RequestIdMode added in v0.3.0

type RequestIdMode int
const (
	AcceptFromHeader RequestIdMode = iota
	AlwaysGenerate
)

func ParseRequestId added in v0.3.0

func ParseRequestId(s string) RequestIdMode

func (*RequestIdMode) SetValue added in v0.3.0

func (f *RequestIdMode) SetValue(s string) error

func (RequestIdMode) String added in v0.3.0

func (r RequestIdMode) String() string

Jump to

Keyboard shortcuts

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