Skip to content

Commit 3d8e538

Browse files
committed
[fix] better code
1 parent 5a1504f commit 3d8e538

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/http-proxy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ proxy.createProxyServer = proxy.createServer = function createProxyServer(option
3939
].join("\n"));
4040
} */
4141

42-
return new ProxyServer(options, httpProxy.createWebProxy(options), httpProxy.createWsProxy(options));
42+
return new ProxyServer(options);
4343
};
4444

lib/http-proxy/index.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ var httpProxy = exports,
44
EE3 = require('eventemitter3').EventEmitter,
55
web = require('./passes/web-incoming'),
66
ws = require('./passes/ws-incoming');
7-
8-
httpProxy.createWebProxy = createRightProxy('web');
9-
httpProxy.createWsProxy = createRightProxy('ws');
10-
httpProxy.Server = ProxyServer;
7+
8+
httpProxy.Server = ProxyServer;
119

1210
/**
1311
* Returns a function that creates the loader for
@@ -89,11 +87,11 @@ function createRightProxy(type) {
8987
}
9088

9189

92-
function ProxyServer(options, web, ws) {
90+
function ProxyServer(options) {
9391
EE3.call(this);
9492

95-
this.web = web;
96-
this.ws = ws;
93+
this.web = createRightProxy('web')(options);
94+
this.ws = reateRightProxy('ws')(options);
9795
this.options = options;
9896

9997
this.passes = Object.keys(passes).map(function(pass) {

0 commit comments

Comments
 (0)