Skip to content

Commit 8408720

Browse files
ArcanoxDragonjcrugzz
authored andcommitted
Properly write response header optionally including statusMessage (http-party#1061)
1 parent b98c75b commit 8408720

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ var redirectRegex = /^201|30(1|2|7|8)$/;
108108
* @api private
109109
*/
110110
function writeStatusCode(req, res, proxyRes) {
111-
res.statusCode = proxyRes.statusCode;
111+
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
112112
if(proxyRes.statusMessage) {
113-
res.statusMessage = proxyRes.statusMessage;
113+
res.writeHead(proxyRes.statusCode, proxyRes.statusMessage);
114+
} else {
115+
res.writeHead(proxyRes.statusCode);
114116
}
115117
}
116118

0 commit comments

Comments
 (0)