File tree 2 files changed +17
-5
lines changed
integration/hello-world/e2e
2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ class TestController {
45
45
overviewById ( ) {
46
46
return RETURN_VALUE ;
47
47
}
48
+
49
+ @Get ( 'multiple/exclude' )
50
+ multipleExclude ( ) {
51
+ return RETURN_VALUE ;
52
+ }
48
53
}
49
54
50
55
@Module ( {
@@ -59,6 +64,7 @@ class TestModule {
59
64
path : 'middleware' ,
60
65
method : RequestMethod . POST ,
61
66
} )
67
+ . exclude ( 'multiple/exclude' )
62
68
. forRoutes ( '*' ) ;
63
69
}
64
70
}
@@ -110,6 +116,12 @@ describe('Exclude middleware', () => {
110
116
. expect ( 200 , RETURN_VALUE ) ;
111
117
} ) ;
112
118
119
+ it ( `should exclude "/multiple/exclude" endpoint` , ( ) => {
120
+ return request ( app . getHttpServer ( ) )
121
+ . get ( '/multiple/exclude' )
122
+ . expect ( 200 , RETURN_VALUE ) ;
123
+ } ) ;
124
+
113
125
afterEach ( async ( ) => {
114
126
await app . close ( ) ;
115
127
} ) ;
Original file line number Diff line number Diff line change @@ -58,8 +58,9 @@ export class MiddlewareBuilder implements MiddlewareConsumer {
58
58
public exclude (
59
59
...routes : Array < string | RouteInfo >
60
60
) : MiddlewareConfigProxy {
61
- this . excludedRoutes = this . getRoutesFlatList ( routes ) . reduce (
62
- ( excludedRoutes , route ) => {
61
+ this . excludedRoutes = [
62
+ ...this . excludedRoutes ,
63
+ ...this . getRoutesFlatList ( routes ) . reduce ( ( excludedRoutes , route ) => {
63
64
for ( const routePath of this . routeInfoPathExtractor . extractPathFrom (
64
65
route ,
65
66
) ) {
@@ -70,9 +71,8 @@ export class MiddlewareBuilder implements MiddlewareConsumer {
70
71
}
71
72
72
73
return excludedRoutes ;
73
- } ,
74
- [ ] as RouteInfo [ ] ,
75
- ) ;
74
+ } , [ ] as RouteInfo [ ] ) ,
75
+ ] ;
76
76
77
77
return this ;
78
78
}
You can’t perform that action at this time.
0 commit comments