🔒️(y-provider) add cors middlewares

Add cors middlewares to y-provider server.
It will control how clients connect to the server
with http requests.
This commit is contained in:
Anthony LC
2024-12-23 10:53:56 +01:00
committed by Anthony LC
parent e53465ce11
commit 94a9f7a84e
5 changed files with 31 additions and 28 deletions

View File

@@ -24,16 +24,6 @@ describe('Server Tests', () => {
server.close();
});
test('POST /collaboration/api/reset-connections?room=[ROOM_ID] invalid origin', async () => {
const response = await request(app as any)
.post('/collaboration/api/reset-connections/?room=test-room')
.set('Origin', 'http://invalid-origin.com')
.send({ document_id: 'test-document' });
expect(response.status).toBe(403);
expect(response.body.error).toBe('CORS policy violation: Invalid Origin');
});
test('POST /collaboration/api/reset-connections?room=[ROOM_ID] with incorrect API key should return 403', async () => {
const response = await request(app as any)
.post('/collaboration/api/reset-connections/?room=test-room')