From 87b0368b9ab1accaac6e05406502a56be1f2b156 Mon Sep 17 00:00:00 2001 From: sunlei Date: Wed, 24 Jun 2026 13:17:59 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=A6=86=E7=9B=96NapCat=20WebUI?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E5=AF=86=E9=92=A5=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../session-store.spec.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/apps/napcat-webui-gateway/session-store.spec.ts b/test/apps/napcat-webui-gateway/session-store.spec.ts index 23924a2..0774bd2 100644 --- a/test/apps/napcat-webui-gateway/session-store.spec.ts +++ b/test/apps/napcat-webui-gateway/session-store.spec.ts @@ -403,7 +403,7 @@ describe('InternalSessionController', () => { expect(response.body.iframeUrl).not.toContain('127.0.0.1'); }); - it('rejects missing or wrong secrets for mutating calls', async () => { + it('rejects missing or wrong secrets for all mutating calls', async () => { await request(app.getHttpServer()) .post('/internal/sessions') .send(createSessionInput()) @@ -413,6 +413,24 @@ describe('InternalSessionController', () => { .set('x-kt-gateway-secret', 'wrong-secret') .send(createSessionInput()) .expect(HttpStatus.UNAUTHORIZED); + await request(app.getHttpServer()) + .post('/internal/sessions/session-1/heartbeat') + .send({ adminUserId: 'admin-1' }) + .expect(HttpStatus.UNAUTHORIZED); + await request(app.getHttpServer()) + .post('/internal/sessions/session-1/heartbeat') + .set('x-kt-gateway-secret', 'wrong-secret') + .send({ adminUserId: 'admin-1' }) + .expect(HttpStatus.UNAUTHORIZED); + await request(app.getHttpServer()) + .post('/internal/sessions/session-1/revoke') + .send({ adminUserId: 'admin-1' }) + .expect(HttpStatus.UNAUTHORIZED); + await request(app.getHttpServer()) + .post('/internal/sessions/session-1/revoke') + .set('x-kt-gateway-secret', 'wrong-secret') + .send({ adminUserId: 'admin-1' }) + .expect(HttpStatus.UNAUTHORIZED); await request(app.getHttpServer()) .get('/internal/health') .expect(HttpStatus.OK);