Skip to content

Commit c6b7a79

Browse files
committed
[fix] always be an eventemitter for consistency fixes #606
1 parent 7e5feec commit c6b7a79

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

lib/http-proxy.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ var http = require('http'),
88
*/
99
module.exports = httpProxy.Server;
1010

11-
module.exports.createProxy = function(options) {
12-
return {
13-
web: httpProxy.createRightProxy('web')(options),
14-
ws: httpProxy.createRightProxy('ws')(options)
15-
};
16-
}
17-
1811
/**
1912
* Creates the proxy server.
2013
*
@@ -30,7 +23,9 @@ module.exports.createProxy = function(options) {
3023
* @api public
3124
*/
3225

33-
module.exports.createProxyServer = module.exports.createServer = function createProxyServer(options) {
26+
module.exports.createProxyServer =
27+
module.exports.createServer =
28+
module.exports.createProxy = function createProxyServer(options) {
3429
/*
3530
* `options` is needed and it must have the following layout:
3631
*

lib/http-proxy/index.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,10 @@ httpProxy.Server = ProxyServer;
2626
*/
2727

2828
function createRightProxy(type) {
29-
var webPasses = Object.keys(web).map(function(pass) {
30-
return web[pass];
31-
});
32-
var wsPasses = Object.keys(ws).map(function(pass) {
33-
return ws[pass];
34-
});
29+
3530
return function(options) {
3631
return function(req, res /*, [head], [opts] */) {
37-
var passes = (type === 'ws') ? (this.wsPasses || wsPasses) : (this.webPasses || webPasses),
32+
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
3833
args = [].slice.call(arguments),
3934
cntr = args.length - 1,
4035
head, cbl;

0 commit comments

Comments
 (0)