middleware

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReqID

func GetReqID(ctx context.Context) string

GetReqID extracts the request ID from the provided context. If no request ID is found, it returns an empty string.

func NewAuth

func NewAuth(validKeys []string) func(http.Handler) http.Handler

NewAuth creates a middleware that validates API key authentication. It checks the Authorization header for a valid Bearer token against the provided list of valid keys. If no valid keys are configured, all requests are rejected.

func NewReqID

func NewReqID() func(http.Handler) http.Handler

func Use

func Use(handler func(http.ResponseWriter, *http.Request), middlewares ...func(http.Handler) http.Handler) http.Handler

Use applies a list of middleware functions to an http.Handler. Middlewares are applied in reverse order so that the first middleware wraps the handler last, preserving the expected chaining behavior.

Types

This section is empty.

Jump to

Keyboard shortcuts

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