requestid

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeaderKey is the default header key for request ID.
	HeaderKey = "X-Request-ID"
)

Variables

This section is empty.

Functions

func New

func New() rex.Middleware

New creates a new RequestID middleware with the default configuration.

func WithConfig

func WithConfig(config Config) rex.Middleware

WithConfig creates a new RequestID middleware with the given configuration.

Types

type Config

type Config struct {
	// Generator defines a function to generate an ID.
	// Defaults to a random 32-character hex string.
	Generator func() string

	// Header is the header key to set.
	// Defaults to "X-Request-ID".
	Header string
}

Config defines the config for RequestID middleware.

Jump to

Keyboard shortcuts

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