Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/api_validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,19 @@ describe('Input Validation', () => {
expect(response.statusCode).toBe(400);
});

test('rejects lineId exceeding 200 characters', async () => {
const response = await server.inject({
method: 'POST',
url: '/api/v1/session',
body: {
productionId: '1',
lineId: 'x'.repeat(201),
username: 'user'
}
});
expect(response.statusCode).toBe(400);
});

test('rejects username exceeding 200 characters', async () => {
const response = await server.inject({
method: 'POST',
Expand Down
4 changes: 2 additions & 2 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export const DetailedProductionResponse = Type.Object({

export const NewSession = Type.Object({
productionId: Type.String({ minLength: 1, pattern: '^[0-9]+$' }),
lineId: Type.String({ minLength: 1 }),
lineId: Type.String({ minLength: 1, maxLength: 200 }),
username: Type.String({ minLength: 1, maxLength: 200 })
});

Expand All @@ -316,7 +316,7 @@ export const SessionResponse = Type.Object({
});

export const SdpAnswer = Type.Object({
sdpAnswer: Type.String()
sdpAnswer: Type.String({ maxLength: 65536 })
});

export const ErrorResponse = Type.Object({
Expand Down
Loading