in-process-request
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -7,9 +7,23 @@ "use strict"; | ||
}; | ||
const fixHeaders = (headers) => { | ||
const headersCopy = {}; | ||
Object.keys(headers).forEach(k => { | ||
if (typeof headers[k] === 'number') { | ||
headersCopy[k] = headers[k].toString(); | ||
} | ||
else { | ||
headersCopy[k] = headers[k]; | ||
} | ||
}); | ||
return headersCopy; | ||
}; | ||
exports.default = (res) => { | ||
let headers; | ||
if (typeof res.getHeaders === 'function') { | ||
return res.getHeaders(); | ||
headers = res.getHeaders(); | ||
} | ||
else { | ||
return getHeadersLegacy(res); | ||
headers = getHeadersLegacy(res); | ||
} | ||
return fixHeaders(headers); | ||
}; |
@@ -37,3 +37,3 @@ "use strict"; | ||
const body = Buffer.concat(chunks); | ||
const headers = Object.assign({}, getHeaders_1.default(res)); | ||
const headers = getHeaders_1.default(res); | ||
const response = { | ||
@@ -40,0 +40,0 @@ body, |
{ | ||
"name": "in-process-request", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "(MIT OR Apache-2.0)", | ||
@@ -5,0 +5,0 @@ "scripts": { |
10201
152