mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-14 04:10:00 +00:00
stream/types: attempt to pass through headers only if they exist
This commit is contained in:
parent
66e58d21ec
commit
5f1dc89c42
1 changed files with 5 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue