mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Fix for Reason-Phrase being overwritten on proxy response. (#1051)
* Fix for Reason-Phrase being overwritten on proxy response. Calling res.writeHead has the side effect of defaulting the Reason-Phrase to default ones. I'm using Reason-Phrase codes to sub-route api responses and they were all being reset. This change only sets the statusMessage (Reason-Phrase) if it exists on the proxyRes and is successfully passing it through in my tests. * Fixed spaces and bracket formatting.
This commit is contained in:
parent
1e52f660f0
commit
d8fb344715
@ -108,7 +108,10 @@ var redirectRegex = /^201|30(1|2|7|8)$/;
|
||||
* @api private
|
||||
*/
|
||||
function writeStatusCode(req, res, proxyRes) {
|
||||
res.writeHead(proxyRes.statusCode);
|
||||
res.statusCode = proxyRes.statusCode;
|
||||
if(proxyRes.statusMessage) {
|
||||
res.statusMessage = proxyRes.statusMessage;
|
||||
}
|
||||
}
|
||||
|
||||
] // <--
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user