diff --git a/packages/core/src/routes/application.test.ts b/packages/core/src/routes/application.test.ts index 6fc0364ec..7a73dd3f3 100644 --- a/packages/core/src/routes/application.test.ts +++ b/packages/core/src/routes/application.test.ts @@ -58,7 +58,7 @@ describe('application route', () => { const response = await applicationRequest.get('/applications'); expect(response.status).toEqual(200); expect(response.body).toEqual([mockApplication]); - expect(response.header).toHaveProperty('total-number', '10'); + expect(response.header).not.toHaveProperty('total-number'); }); it('POST /applications', async () => { diff --git a/packages/core/src/routes/application.ts b/packages/core/src/routes/application.ts index 8f7dbee4e..f096718e6 100644 --- a/packages/core/src/routes/application.ts +++ b/packages/core/src/routes/application.ts @@ -38,10 +38,16 @@ export default function applicationRoutes( router.get( '/applications', - koaPagination(), + koaPagination({ isOptional: true }), koaGuard({ response: z.array(Applications.guard), status: 200 }), async (ctx, next) => { - const { limit, offset } = ctx.pagination; + const { limit, offset, disabled: paginationDisabled } = ctx.pagination; + + if (paginationDisabled) { + ctx.body = await findAllApplications(); + + return next(); + } const [{ count }, applications] = await Promise.all([ findTotalNumberOfApplications(),