Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): resolve :param retrieval in prefix in middleware #13886

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
test: add test case for middleware param retrieval
CodyTseng committed Aug 14, 2024
commit efb30c1d6707a8d0564dc2dd3ed4cb85f5a7abb0
Original file line number Diff line number Diff line change
@@ -130,6 +130,17 @@ describe('Global prefix', () => {
.expect(200, { '0': 'params', tenantId: 'test' });
});

it(`should get the params in the global prefix with exclude option`, async () => {
app.setGlobalPrefix('/api/:tenantId', { exclude: ['/'] });

server = app.getHttpServer();
await app.init();

await request(server)
.get('/api/test/params')
.expect(200, { '0': 'params', tenantId: 'test' });
});

it(`should execute middleware only once`, async () => {
app.setGlobalPrefix('/api', { exclude: ['/'] });