From 5f1dc89c42e98be19a9472ebcbb0f6b9bbca1e70 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 27 Apr 2024 10:47:09 +0000 Subject: [PATCH] stream/types: attempt to pass through headers only if they exist --- src/modules/stream/types.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js index 10bd3a66..b5320003 100644 --- a/src/modules/stream/types.js +++ b/src/modules/stream/types.js @@ -88,8 +88,11 @@ export async function streamDefault(streamInfo, res) { maxRedirections: 16 }); - res.setHeader('content-type', headers['content-type']); - res.setHeader('content-length', headers['content-length']); + for (const headerName of ['content-type', 'content-length']) { + if (headers[headerName]) { + res.setHeader(headerName, headers[headerName]); + } + } pipe(stream, res, shutdown); } catch {