middleware

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const RequestIDHeader = "X-Request-ID"

Variables

This section is empty.

Functions

func GetRequestIDFromRequest

func GetRequestIDFromRequest(r *http.Request) string

GetRequestIDFromRequest extracts the request ID from the HTTP request. Returns empty string if request ID is not found.

func Logger

func Logger() func(next http.Handler) http.Handler

Logger returns a middleware that logs HTTP requests using zap logger. It logs request start with requestId and all fields except status, then request end with requestId and status.

func RequestID

func RequestID(next http.Handler) http.Handler

RequestID gets the request ID from the x-request-id header or generates a unique request ID for each HTTP request and injects it into the request's context.Context for consistent access across the application layer. This middleware enhances Chi's built-in RequestID middleware by ensuring request IDs are available via our requestid package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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