You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
527 B
JavaScript

'use strict';
function copyProxyResHeadersToUserRes(container) {
return new Promise(function(resolve) {
var res = container.user.res;
var rsp = container.proxy.res;
if (!res.headersSent) {
res.status(rsp.statusCode);
Object.keys(rsp.headers)
.filter(function(item) { return item !== 'transfer-encoding'; })
.forEach(function(item) {
res.set(item, rsp.headers[item]);
});
}
resolve(container);
});
}
module.exports = copyProxyResHeadersToUserRes;