httpmw

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package httpmw provides net/http middleware for request-id propagation and access logging. It also covers chi, which uses the stdlib signature.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(logger *slog.Logger, opts ...Option) func(http.Handler) http.Handler

Middleware returns net/http middleware that injects a request-scoped logger and emits one access-log entry per request.

Types

type Option

type Option func(*config)

Option configures the middleware.

func WithGenerator

func WithGenerator(fn func() string) Option

WithGenerator overrides the request-id generator.

func WithHeader

func WithHeader(name string) Option

WithHeader overrides the request-id header name.

Source Files

  • http.go

Jump to

Keyboard shortcuts

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