fix(core): fix middleware for versioned routes

fix middlewares for versioned routes using media type as versioning type
This commit is contained in:
Thiago Martins
2022-10-31 17:42:52 -03:00
parent 4a039327bf
commit cf1b946e62

View File

@@ -50,7 +50,7 @@ describe('Middleware', () => {
app = await createAppWithVersioningType(VersioningType.URI);
});
it(`forRoutes({ path: ';versioned', version: '1', method: RequestMethod.ALL })`, () => {
it(`forRoutes({ path: '/versioned', version: '1', method: RequestMethod.ALL })`, () => {
return request(app.getHttpServer())
.get('/v1/versioned')
.expect(200, VERSIONED_VALUE);
@@ -62,7 +62,19 @@ describe('Middleware', () => {
app = await createAppWithVersioningType(VersioningType.HEADER);
});
it(`forRoutes({ path: 'tests/versioned', version: '1', method: RequestMethod.ALL })`, () => {
it(`forRoutes({ path: '/versioned', version: '1', method: RequestMethod.ALL })`, () => {
return request(app.getHttpServer())
.get('/versioned')
.expect(200, VERSIONED_VALUE);
});
});
describe('when using MEDIA TYPE versioning', () => {
beforeEach(async () => {
app = await createAppWithVersioningType(VersioningType.MEDIA_TYPE);
});
it(`forRoutes({ path: '/versioned', version: '1', method: RequestMethod.ALL })`, () => {
return request(app.getHttpServer())
.get('/versioned')
.expect(200, VERSIONED_VALUE);