fix bm router USE (#271)

pull/272/head
Felix Hao 5 years ago committed by GitHub
parent 934a84e69b
commit 85b9d677b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/net/http/blademaster/routergroup.go
  2. 2
      pkg/net/http/blademaster/server.go

@ -134,7 +134,6 @@ func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) IRo
return group.handle("HEAD", relativePath, handlers...) return group.handle("HEAD", relativePath, handlers...)
} }
func (group *RouterGroup) combineHandlers(handlerGroups ...[]HandlerFunc) []HandlerFunc { func (group *RouterGroup) combineHandlers(handlerGroups ...[]HandlerFunc) []HandlerFunc {
finalSize := len(group.Handlers) finalSize := len(group.Handlers)
for _, handlers := range handlerGroups { for _, handlers := range handlerGroups {
@ -190,4 +189,3 @@ func (group *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) IRou
group.handle("TRACE", relativePath, handlers...) group.handle("TRACE", relativePath, handlers...)
return group.returnObj() return group.returnObj()
} }

@ -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. // For example, this is the right place for a logger or error management middleware.
func (engine *Engine) Use(middleware ...Handler) IRoutes { func (engine *Engine) Use(middleware ...Handler) IRoutes {
engine.RouterGroup.Use(middleware...) engine.RouterGroup.Use(middleware...)
engine.rebuild404Handlers()
engine.rebuild405Handlers()
return engine return engine
} }

Loading…
Cancel
Save