fix(router): missing support for mux server in router constructor

This commit is contained in:
Guz
2024-12-13 16:13:26 -03:00
parent 5b5de7b206
commit 23ac6d6220

View File

@@ -41,10 +41,17 @@ type Route struct {
}
func NewRouter(mux ...*http.ServeMux) Router {
var m *http.ServeMux
if len(mux) > 0 {
m = mux[0]
} else {
m = http.NewServeMux()
}
return &defaultRouter{
http.NewServeMux(),
m,
[]middleware.Middleware{},
map[string]http.Handler{},
map[string]Route{},
}
}