httpmw

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextMiddleware

func ContextMiddleware(opts ...Option) func(http.Handler) http.Handler

ContextMiddleware enriches the request context with identifiers commonly used by the logger.

Types

type Option

type Option func(*options)

Option configures the behaviour of the ContextMiddleware.

func WithGenerateMissingIDs

func WithGenerateMissingIDs(enable bool) Option

WithGenerateMissingIDs instructs the middleware to create ids when headers are absent.

func WithIDGenerator

func WithIDGenerator(fn func() string) Option

WithIDGenerator provides a custom generator used when headers are missing.

func WithRequestHeader

func WithRequestHeader(name string) Option

WithRequestHeader configures the header used to populate the request id.

func WithTraceHeader

func WithTraceHeader(name string) Option

WithTraceHeader configures the header used to populate the trace id.

Jump to

Keyboard shortcuts

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