Prevent headers to be sent twice

This commit is contained in:
Sam Alba 2013-03-21 16:44:32 -07:00 committed by indexzero
parent 145798062e
commit 8332e74420

View File

@ -333,10 +333,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
}
// Set the headers of the client response
Object.keys(response.headers).forEach(function (key) {
res.setHeader(key, response.headers[key]);
});
res.writeHead(response.statusCode);
if (res.sentHeaders !== true) {
Object.keys(response.headers).forEach(function (key) {
res.setHeader(key, response.headers[key]);
});
res.writeHead(response.statusCode);
}
function ondata(chunk) {
if (res.writable) {