middleware

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const RequestIDKey contextKey = "request_id"

RequestIDKey is the context key for storing request IDs

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(username, password string) func(http.Handler) http.Handler

BasicAuth creates a basic authentication middleware This is used for metrics endpoint

func CORS

func CORS(next http.Handler) http.Handler

CORS creates a new CORS middleware that always allows all origins

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID retrieves the request ID from the context

func Logger

func Logger(next http.Handler) http.Handler

Logger creates a new logger middleware

func PrometheusMiddleware

func PrometheusMiddleware(next http.Handler) http.Handler

PrometheusMiddleware creates a middleware for Prometheus metrics

func RequestID

func RequestID(next http.Handler) http.Handler

RequestID middleware adds a unique request ID to each request It checks for existing X-Request-ID header, or generates a new UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

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