[fix] always be an eventemitter for consistency fixes #606

This commit is contained in:
Jarrett Cruger 2014-04-09 13:37:27 -04:00
parent 7e5feec34f
commit c6b7a7919f
2 changed files with 5 additions and 15 deletions

View File

@ -8,13 +8,6 @@ var http = require('http'),
*/ */
module.exports = httpProxy.Server; module.exports = httpProxy.Server;
module.exports.createProxy = function(options) {
return {
web: httpProxy.createRightProxy('web')(options),
ws: httpProxy.createRightProxy('ws')(options)
};
}
/** /**
* Creates the proxy server. * Creates the proxy server.
* *
@ -30,7 +23,9 @@ module.exports.createProxy = function(options) {
* @api public * @api public
*/ */
module.exports.createProxyServer = module.exports.createServer = function createProxyServer(options) { module.exports.createProxyServer =
module.exports.createServer =
module.exports.createProxy = function createProxyServer(options) {
/* /*
* `options` is needed and it must have the following layout: * `options` is needed and it must have the following layout:
* *

View File

@ -26,15 +26,10 @@ httpProxy.Server = ProxyServer;
*/ */
function createRightProxy(type) { function createRightProxy(type) {
var webPasses = Object.keys(web).map(function(pass) {
return web[pass];
});
var wsPasses = Object.keys(ws).map(function(pass) {
return ws[pass];
});
return function(options) { return function(options) {
return function(req, res /*, [head], [opts] */) { return function(req, res /*, [head], [opts] */) {
var passes = (type === 'ws') ? (this.wsPasses || wsPasses) : (this.webPasses || webPasses), var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
args = [].slice.call(arguments), args = [].slice.call(arguments),
cntr = args.length - 1, cntr = args.length - 1,
head, cbl; head, cbl;