Skip to content

Commit 162730d

Browse files
committed
fixup! šŸ›(y-provider) increase JSON size limits for transcription conversion
1 parent 3cdfdd4 commit 162730d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

ā€Žsrc/frontend/servers/y-provider/__tests__/server.test.tsā€Ž

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import request from 'supertest';
22

3+
import { routes } from '@/routes';
4+
35
const port = 5557;
46
const origin = 'http://localhost:3000';
57

@@ -36,4 +38,34 @@ describe('Server Tests', () => {
3638
expect(response.body.error).toBe('Forbidden');
3739
});
3840
});
41+
42+
it('should allow JSON payloads up to 500kb for the CONVERT_MARKDOWN route', async () => {
43+
const largePayload = 'a'.repeat(400 * 1024); // 400kb payload
44+
const response = await request(app)
45+
.post(routes.CONVERT_MARKDOWN)
46+
.send({ data: largePayload })
47+
.set('Content-Type', 'application/json');
48+
49+
expect(response.status).not.toBe(413);
50+
});
51+
52+
it('should reject JSON payloads larger than 500kb for the CONVERT_MARKDOWN route', async () => {
53+
const oversizedPayload = 'a'.repeat(501 * 1024); // 501kb payload
54+
const response = await request(app)
55+
.post(routes.CONVERT_MARKDOWN)
56+
.send({ data: oversizedPayload })
57+
.set('Content-Type', 'application/json');
58+
59+
expect(response.status).toBe(413);
60+
});
61+
62+
it('should use the default JSON limit for other routes', async () => {
63+
const largePayload = 'a'.repeat(150 * 1024);
64+
const response = await request(app)
65+
.post('/some-other-route')
66+
.send({ data: largePayload })
67+
.set('Content-Type', 'application/json');
68+
69+
expect(response.status).toBe(413);
70+
});
3971
});

0 commit comments

Comments
Ā (0)