Skip to content

best way to save what you love

stream/types: attempt to pass through headers only if they exist

dumbmoron5f1dc89c42e9
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 {