package server import ( "log/slog" "net/http" "sneak.berlin/go/webhooker/internal/config" "sneak.berlin/go/webhooker/internal/handlers" "sneak.berlin/go/webhooker/internal/middleware" ) // MaxFormBodySizeForTest exposes the form body cap so tests can // build requests that sit exactly at, below, and above it. const MaxFormBodySizeForTest = maxFormBodySize // NewRouterForTest builds the real route tree via SetupRoutes with // the supplied middleware and handlers, bypassing the fx lifecycle // and the HTTP listener. Tests use it so that route-group middleware // registration order is exercised exactly as it ships, rather than // against a hand-rebuilt chain that could drift from routes.go. func NewRouterForTest( log *slog.Logger, cfg *config.Config, mw *middleware.Middleware, h *handlers.Handlers, ) http.Handler { s := &Server{ log: log, mw: mw, h: h, params: ServerParams{Config: cfg}, } s.SetupRoutes() return s.router }