diff --git a/router.go b/router.go index 584ba01..1584600 100644 --- a/router.go +++ b/router.go @@ -136,7 +136,11 @@ func (r *Router) getHttpr() *httprouter.Router { handle = handlePOST(r, v.Handle) } - httpr.Handle(v.Method, v.Path, handleReq(r, handle, append(r.middleware, v.Middleware...))) + middleware := make([]Middleware, len(r.middleware)+len(v.Middleware)) + copy(middleware, r.middleware) + copy(middleware[len(r.middleware):], v.Middleware) + + httpr.Handle(v.Method, v.Path, handleReq(r, handle, middleware)) } httpr.NotFound = http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {