Skip to content

Commit

Permalink
#2870 add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny5487401 committed Sep 9, 2024
1 parent ad9ec39 commit 20d2081
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions rest/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (ng *engine) bindRoute(fr featuredRoutes, router httpx.Router, metrics *sta
chn = chain.New()
}
if ng.conf.AddNativeMiddlewares {
ng.buildChainWithNativeMiddlewares(chn, fr, route, metrics)
chn = ng.buildChainWithNativeMiddlewares(chn, fr, route, metrics)
}

chn = ng.appendAuthHandler(fr, chn, verifier)
Expand All @@ -127,7 +127,7 @@ func (ng *engine) bindRoutes(router httpx.Router) error {
}

func (ng *engine) buildChainWithNativeMiddlewares(chn chain.Chain, fr featuredRoutes, route Route,
metrics *stat.Metrics) {
metrics *stat.Metrics) chain.Chain {

if ng.conf.Middlewares.Trace {
chn = chn.Append(handler.TraceHandler(ng.conf.Name,
Expand Down Expand Up @@ -164,6 +164,7 @@ func (ng *engine) buildChainWithNativeMiddlewares(chn chain.Chain, fr featuredRo
if ng.conf.Middlewares.Gunzip {
chn = chn.Append(handler.GunzipHandler)
}
return chn

}

Expand Down
2 changes: 1 addition & 1 deletion rest/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func TestServer_WithChain(t *testing.T) {
}
}

server := MustNewServer(RestConf{}, WithChain(chain.New(middleware1(), middleware2())))
server := MustNewServer(RestConf{AddNativeMiddlewares: true, Middlewares: MiddlewaresConf{Log: true}}, WithChain(chain.New(middleware1(), middleware2())))
server.AddRoutes(
[]Route{
{
Expand Down

0 comments on commit 20d2081

Please sign in to comment.