From 773239c2cdae02405685afa79a3f53db56ca8b3d Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 9 Nov 2026 15:27:03 -0800 Subject: [PATCH] test(e2e): stop requiring Content-Length on streamed Route Handler downloads Next.js 16.4.5 strips Content-Length and Content-Encoding from every Route Handler response (GHSA-pc58-hwjq-p385); upstream kept that in 16.4.6 and closed the scoped alternative, so a large download now arrives chunked without a declared length. The history suite still proves incremental delivery, the full byte count and the content hash, and checks a declared length whenever one is present. --- apps/sim/scripts/test-project-file-history-e2e.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/sim/scripts/test-project-file-history-e2e.ts b/apps/sim/scripts/test-project-file-history-e2e.ts index 15fbae6dfec..ecf372ac554 100644 --- a/apps/sim/scripts/test-project-file-history-e2e.ts +++ b/apps/sim/scripts/test-project-file-history-e2e.ts @@ -69,7 +69,9 @@ async function verifyStreamedDownload( signal: AbortSignal.timeout(90_000), }) assert.equal(response.status, 200) - assert.equal(Number(response.headers.get('content-length')), expectedBytes) + // Next 16.4.5+ strips Content-Length from every Route Handler response (GHSA-pc58-hwjq-p385). + const declaredLength = response.headers.get('content-length') + if (declaredLength !== null) assert.equal(Number(declaredLength), expectedBytes) assert.ok(response.body) const reader = response.body.getReader() const hash = createHash('sha256')