From 85b9d677b76788802229bc543a474f25023120be Mon Sep 17 00:00:00 2001 From: Felix Hao Date: Thu, 15 Aug 2019 17:42:51 +0800 Subject: [PATCH] fix bm router USE (#271) --- pkg/net/http/blademaster/routergroup.go | 2 -- pkg/net/http/blademaster/server.go | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/net/http/blademaster/routergroup.go b/pkg/net/http/blademaster/routergroup.go index 9859539fc..281796b12 100644 --- a/pkg/net/http/blademaster/routergroup.go +++ b/pkg/net/http/blademaster/routergroup.go @@ -134,7 +134,6 @@ func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) IRo return group.handle("HEAD", relativePath, handlers...) } - func (group *RouterGroup) combineHandlers(handlerGroups ...[]HandlerFunc) []HandlerFunc { finalSize := len(group.Handlers) for _, handlers := range handlerGroups { @@ -190,4 +189,3 @@ func (group *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) IRou group.handle("TRACE", relativePath, handlers...) return group.returnObj() } - diff --git a/pkg/net/http/blademaster/server.go b/pkg/net/http/blademaster/server.go index ee629c6af..5cd2bc6f4 100644 --- a/pkg/net/http/blademaster/server.go +++ b/pkg/net/http/blademaster/server.go @@ -383,6 +383,8 @@ func (engine *Engine) UseFunc(middleware ...HandlerFunc) IRoutes { // For example, this is the right place for a logger or error management middleware. func (engine *Engine) Use(middleware ...Handler) IRoutes { engine.RouterGroup.Use(middleware...) + engine.rebuild404Handlers() + engine.rebuild405Handlers() return engine }