stream/internal: also copy content-length where applicable

This commit is contained in:
dumbmoron 2024-04-27 11:10:26 +00:00
parent 6eb4af125b
commit 3d3a717f3e
No known key found for this signature in database

View file

@ -58,7 +58,11 @@ async function handleYoutubeStream(streamInfo, res) {
const stream = chunkedStream(streamInfo, size); const stream = chunkedStream(streamInfo, size);
res.setHeader('content-type', req.headers.get('content-type')); for (const headerName of ['content-type', 'content-length']) {
const headerValue = req.headers.get(headerName);
if (headerValue) res.setHeader(headerName, headerValue);
}
stream.pipe(res); stream.pipe(res);
stream.on('error', () => res.destroy()); stream.on('error', () => res.destroy());
} catch { } catch {