mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
23 lines
527 B
JavaScript
Executable File
23 lines
527 B
JavaScript
Executable File
'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;
|
|
|