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`); throw new Error(`Response ${res.status} not OK`);
} }
console.log(res.headers);
return { return {
mimetype: (source.expectType mimetype: (source.expectType
? source.expectType[res.headers['content-type']] ? source.expectType[res.headers['content-type']]

View File

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