Explicitly adding headers to http module result.

This commit is contained in:
DebaucheryLibrarian 2021-11-21 00:41:12 +01:00
parent 0a8a7ff9a5
commit 2be3ea9bbb
2 changed files with 4 additions and 0 deletions

View File

@ -549,6 +549,8 @@ async function fetchHttpSource(source, tempFileTarget, hashStream) {
throw new Error(`Response ${res.status} not OK`);
}
console.log(res.headers);
return {
mimetype: (source.expectType
? source.expectType[res.headers['content-type']]

View File

@ -122,6 +122,7 @@ async function finalizeResult(res, options) {
body: html,
html,
status: res.statusCode,
headers: res.headers,
document: window?.document || null,
window,
ok: res.statusCode >= 200 && res.statusCode <= 299,
@ -132,6 +133,7 @@ async function finalizeResult(res, options) {
...res,
body: res.body,
status: res.statusCode,
headers: res.headers,
ok: res.statusCode >= 200 && res.statusCode <= 299,
};
}