middleware

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package middleware hosts HTTP middleware components.

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 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