Skip to content

Commit 0a86ba0

Browse files
authored
Merge branch 'nestjs:master' into fix-fastify-platfom-custom-methods
2 parents 92bdc6d + 73d4ee6 commit 0a86ba0

File tree

51 files changed

+840
-604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+840
-604
lines changed

integration/hello-world/e2e/middleware-fastify.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Module,
66
NestMiddleware,
77
NestModule,
8+
Param,
89
Query,
910
Req,
1011
RequestMethod,
@@ -439,6 +440,11 @@ describe('Middleware (FastifyAdapter)', () => {
439440
async rootPath(@Req() req: FastifyRequest['raw']) {
440441
return { success: true, root: true };
441442
}
443+
444+
@Get('record/:id')
445+
async record(@Req() req: FastifyRequest['raw'], @Param('id') id: string) {
446+
return { success: true, record: id };
447+
}
442448
}
443449

444450
@Module({
@@ -535,6 +541,32 @@ describe('Middleware (FastifyAdapter)', () => {
535541
.expect(200, { success: true, root: true });
536542
});
537543

544+
it(`GET forRoutes('{*path}') with global prefix and exclude pattern with wildcard`, async () => {
545+
app.setGlobalPrefix('/api', { exclude: ['/record/{*path}'] });
546+
await app.init();
547+
await app.getHttpAdapter().getInstance().ready();
548+
549+
await request(app.getHttpServer())
550+
.get('/api/pong')
551+
.expect(200, { success: true, pong: 'pong' });
552+
await request(app.getHttpServer())
553+
.get('/record/abc123')
554+
.expect(200, { success: true, record: 'abc123' });
555+
});
556+
557+
it(`GET forRoutes('{*path}') with global prefix and exclude pattern with parameter`, async () => {
558+
app.setGlobalPrefix('/api', { exclude: ['/record/:id'] });
559+
await app.init();
560+
await app.getHttpAdapter().getInstance().ready();
561+
562+
await request(app.getHttpServer())
563+
.get('/record/abc123')
564+
.expect(200, { success: true, record: 'abc123' });
565+
await request(app.getHttpServer())
566+
.get('/api/pong')
567+
.expect(200, { success: true, pong: 'pong' });
568+
});
569+
538570
it(`GET forRoutes('{*path}') with global prefix and global prefix options`, async () => {
539571
app.setGlobalPrefix('/api', { exclude: ['/'] });
540572
await app.init();

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "11.0.12"
6+
"version": "11.0.13"
77
}

0 commit comments

Comments
 (0)