fix(transcription): replace sendBeacon with fetch keepalive; add catch-all API proxy #304

Merged
marcel merged 7 commits from fix/204-transcription-beacon-proxy into main 2026-04-23 07:12:23 +02:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit 3488375ad5 - Show all commits

View File

@@ -12,7 +12,8 @@ const HOP_BY_HOP_HEADERS = new Set([
'proxy-authenticate',
'proxy-authorization',
'te',
'trailer'
'trailer',
'proxy-connection'
]);
async function proxy(event: Parameters<RequestHandler>[0]): Promise<Response> {

View File

@@ -167,6 +167,23 @@ describe('catch-all API proxy — forwarding', () => {
expect(response.headers.get('Content-Disposition')).toBe('attachment; filename="document.pdf"');
});
it('does not forward proxy-connection hop-by-hop header', async () => {
const mockFetch = vi.fn().mockResolvedValue(
new Response('data', {
status: 200,
headers: {
'Content-Type': 'application/json',
'Proxy-Connection': 'keep-alive'
}
})
);
const event = makeEvent('documents', 'GET', mockFetch);
const response = await GET(event as never);
expect(response.headers.get('Proxy-Connection')).toBeNull();
});
it('does not forward hop-by-hop headers like transfer-encoding', async () => {
const mockFetch = vi.fn().mockResolvedValue(
new Response('data', {