From 3fc9631fbca56d27d2bccabe870ca07a3fc3015a Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Fri, 27 Jun 2025 22:01:13 -0300 Subject: [PATCH] feat(smallstrip): WithMiddleware option --- smalltrip/options.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/smalltrip/options.go b/smalltrip/options.go index 172caf8..5c573ce 100644 --- a/smalltrip/options.go +++ b/smalltrip/options.go @@ -17,27 +17,24 @@ package smalltrip import ( "log/slog" - "net/http" - "forge.capytal.company/loreddev/x/tinyssert" + "forge.capytal.company/loreddev/x/smalltrip/middleware" ) type Option func(*router) -func WithAssertions(assertions tinyssert.Assertions) Option { - return func(r *router) { - r.assert = assertions - } -} - func WithLogger(logger *slog.Logger) Option { return func(r *router) { r.log = logger } } -func WithServeMux(mux *http.ServeMux) Option { return func(r *router) { - r.mux = mux + } +} + +func WithMiddleware(m middleware.Middleware) Option { + return func(r *router) { + r.Use(m) } }