-
Release v1.0.2 Stable
released this
2026-05-11 22:18:18 -06:00 | 0 commits to main since this releasev1.0.2
code.nochebuena.dev/go/httpmwOverview
httpmwv1.0.2 commits the middleware API as stable. The module provides standalone
net/httpmiddleware functions for transport-layer concerns: panic recovery, CORS,
request ID injection, and structured request logging. Each function is independent;
no authentication or identity logic is included (seehttpauth-firebasefor that).What Changed Since v0.9.0
Dependency bump
logzpromoted to v1.0.1.godirective updated to 1.26.No API changes. All middleware functions (
Recover,CORS,RequestID,
RequestLogger), theLoggerinterface, andStatusRecorderare unchanged.Full API (stable)
Recover() func(http.Handler) http.Handler— catches panics, writes 500; zero
configuration required.CORS(origins []string) func(http.Handler) http.Handler— sets
Access-Control-Allow-*headers; responds 204 to OPTIONS preflight.RequestID(generator func() string) func(http.Handler) http.Handler— generates
a request ID, injects it vialogz.WithRequestID, setsX-Request-IDheader.RequestLogger(logger Logger) func(http.Handler) http.Handler— logs method,
path, status, latency, and request ID; usesErrorfor 5xx,Infofor all others.Logger— duck-typed:Info(msg string, args ...any),Error(msg string, err error, args ...any),With(args ...any) Logger; satisfied bylogz.Logger.StatusRecorder— exportedhttp.ResponseWriterwrapper capturing the written
status code in itsStatusfield.Migration from v0.9.0
No breaking changes. Drop-in replacement.
go get code.nochebuena.dev/go/httpmw@v1.0.2Downloads