mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
don't add upgrade handler if a custom handler is passed in
if a callback but no static proxy is defined and no routes are provided then handlers.length is 1. However the upgrade event is still automagically attached in spite of having an explicit callback.
This commit is contained in:
parent
152d258ea0
commit
d6ea3a425c
@ -57,6 +57,7 @@ var HttpProxy = exports.HttpProxy = require('./node-http-proxy/http-proxy'
|
||||
exports.createServer = function () {
|
||||
var args = Array.prototype.slice.call(arguments),
|
||||
handlers = [],
|
||||
callback,
|
||||
options = {},
|
||||
message,
|
||||
handler,
|
||||
@ -77,7 +78,7 @@ exports.createServer = function () {
|
||||
case 'string': host = arg; break;
|
||||
case 'number': port = arg; break;
|
||||
case 'object': options = arg || {}; break;
|
||||
case 'function': handlers.push(arg); break;
|
||||
case 'function': callback = arg; handlers.push(callback); break;
|
||||
};
|
||||
});
|
||||
|
||||
@ -180,7 +181,7 @@ exports.createServer = function () {
|
||||
proxy.close();
|
||||
});
|
||||
|
||||
if (handlers.length <= 1) {
|
||||
if (!callback) {
|
||||
//
|
||||
// If an explicit callback has not been supplied then
|
||||
// automagically proxy the request using the `HttpProxy`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user