middleware

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

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