Skip to content

Commit e9fd3f4

Browse files
committed
Whitespace fixes
1 parent a088efd commit e9fd3f4

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

lib/node-http-proxy/routing-proxy.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ var RoutingProxy = exports.RoutingProxy = function (options) {
2323

2424
var self = this;
2525
options = options || {};
26-
26+
2727
if (options.router) {
2828
this.proxyTable = new ProxyTable(options);
2929
this.proxyTable.on('routes', function (routes) {
3030
self.emit('routes', routes);
3131
});
3232
}
33-
33+
3434
//
35-
// Create a set of `HttpProxy` objects to be used later on calls
35+
// Create a set of `HttpProxy` objects to be used later on calls
3636
// to `.proxyRequest()` and `.proxyWebSocketRequest()`.
3737
//
3838
this.proxies = {};
39-
39+
4040
//
4141
// Setup default target options (such as `https`).
4242
//
4343
this.target  = {};
4444
this.target.https = options.target && options.target.https;
45-
45+
4646
//
4747
// Setup other default options to be used for instances of
4848
// `HttpProxy` created by this `RoutingProxy` instance.
@@ -68,27 +68,27 @@ util.inherits(RoutingProxy, events.EventEmitter);
6868
RoutingProxy.prototype.add = function (options) {
6969
var self = this,
7070
key = this._getKey(options);
71-
71+
7272
//
7373
// TODO: Consume properties in `options` related to the `ProxyTable`.
7474
//
7575
options.target = options.target || {};
7676
options.target.host = options.target.host || options.host;
7777
options.target.port = options.target.port || options.port;
78-
options.target.https = this.target && this.target.https ||
79-
options.target && options.target.https ||
78+
options.target.https = this.target && this.target.https ||
79+
options.target && options.target.https ||
8080
options.https;
81-
81+
8282
//
8383
// Setup options to pass-thru to the new `HttpProxy` instance
84-
// for the specified `options.host` and `options.port` pair.
84+
// for the specified `options.host` and `options.port` pair.
8585
//
8686
['https', 'enable', 'forward'].forEach(function (key) {
8787
if (options[key] !== false && self[key]) {
8888
options[key] = self[key];
8989
}
9090
});
91-
91+
9292
this.proxies[key] = new HttpProxy(options);
9393
this.proxies[key].on('proxyError', this.emit.bind(this, 'proxyError'));
9494
this.proxies[key].on('webSocketProxyError', this.emit.bind(this, 'webSocketProxyError'));
@@ -111,18 +111,18 @@ RoutingProxy.prototype.remove = function (options) {
111111
//
112112
RoutingProxy.prototype.close = function () {
113113
var self = this;
114-
114+
115115
if (this.proxyTable) {
116116
//
117-
// Close the `RoutingTable` associated with
117+
// Close the `RoutingTable` associated with
118118
// this instance (if any).
119119
//
120120
this.proxyTable.close();
121121
}
122-
122+
123123
//
124124
// Close all sockets for all `HttpProxy` object(s)
125-
// associated with this instance.
125+
// associated with this instance.
126126
//
127127
Object.keys(this.proxies).forEach(function (key) {
128128
self.proxies[key].close();
@@ -160,11 +160,11 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
160160
try {
161161
res.writeHead(404);
162162
res.end();
163-
}
163+
}
164164
catch (er) {
165165
console.error("res.writeHead/res.end error: %s", er.message);
166166
}
167-
167+
168168
return;
169169
}
170170

@@ -179,15 +179,15 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
179179
options.port = location.port;
180180
options.host = location.host;
181181
}
182-
182+
183183
var key = this._getKey(options),
184184
proxy;
185-
185+
186186
if (!this.proxies[key]) {
187187
this.add(options);
188-
189-
}
190-
188+
189+
}
190+
191191
proxy = this.proxies[key];
192192
proxy.proxyRequest(req, res, options.buffer);
193193
};
@@ -206,7 +206,7 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
206206
//
207207
RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options) {
208208
options = options || {};
209-
209+
210210
if (this.proxyTable && !options.host) {
211211
location = this.proxyTable.getProxyLocation(req);
212212

@@ -217,15 +217,15 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti
217217
options.port = location.port;
218218
options.host = location.host;
219219
}
220-
220+
221221
var key = this._getKey(options),
222222
proxy;
223223

224224
if (!this.proxies[key]) {
225225
this.add(options);
226226
}
227227

228-
proxy = this.proxies[key];
228+
proxy = this.proxies[key];
229229
proxy.proxyWebSocketRequest(req, socket, head, options.buffer);
230230
};
231231

@@ -237,14 +237,14 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti
237237
// combination contained within.
238238
//
239239
RoutingProxy.prototype._getKey = function (options) {
240-
if (!options || ((!options.host || !options.port)
240+
if (!options || ((!options.host || !options.port)
241241
&& (!options.target || !options.target.host || !options.target.port))) {
242242
throw new Error('options.host and options.port or options.target are required.');
243243
return;
244244
}
245245

246246
return [
247-
options.host || options.target.host,
247+
options.host || options.target.host,
248248
options.port || options.target.port
249249
].join(':');
250250
}

0 commit comments

Comments
 (0)