Skip to content

Commit 2c44039

Browse files
jfurlerindexzero
authored andcommitted
issue #953: stop using writeHead
object.keys in web-incoming.js results in a non-deterministic ordering of keys, which means that in web-outgoing writeHead might be called before setHeader, which throws an error
1 parent 8097ae2 commit 2c44039

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/http-proxy/passes/web-outgoing.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ module.exports = { // <--
137137
writeStatusCode: function writeStatusCode(req, res, proxyRes) {
138138
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
139139
if(proxyRes.statusMessage) {
140-
res.writeHead(proxyRes.statusCode, proxyRes.statusMessage);
140+
res.statusCode = proxyRes.statusCode;
141+
res.statusMessage = proxyRes.statusMessage;
141142
} else {
142-
res.writeHead(proxyRes.statusCode);
143+
res.statusCode = proxyRes.statusCode;
143144
}
144145
}
145146

0 commit comments

Comments
 (0)