mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-14 12:19:59 +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
|
maxRedirections: 16
|
||||||
});
|
});
|
||||||
|
|
||||||
res.setHeader('content-type', headers['content-type']);
|
for (const headerName of ['content-type', 'content-length']) {
|
||||||
res.setHeader('content-length', headers['content-length']);
|
if (headers[headerName]) {
|
||||||
|
res.setHeader(headerName, headers[headerName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pipe(stream, res, shutdown);
|
pipe(stream, res, shutdown);
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Loading…
Reference in a new issue