Permalink
Browse files

remove `this.proxies`

Only used one time in the constructor, so no need
to keep it around in memory.
  • Loading branch information...
1 parent 4b9941d commit 20fd5d21c64078d3bbb9c4c8fb2de0454a84c986 @TooTallNate committed Jul 15, 2015
Showing with 7 additions and 2 deletions.
  1. +7 −2 index.js
View
@@ -83,7 +83,12 @@ function ProxyAgent (opts) {
debug('creating new ProxyAgent instance: %o', opts);
Agent.call(this, connect);
- this.proxies = extend(Object.create(exports.proxies), opts.proxies);
+ var proxies;
+ if (opts.proxies) {
+ proxies = extend(Object.create(exports.proxies), opts.proxies);
+ } else {
+ proxies = exports.proxies;
+ }
// get the requested proxy "protocol"
var protocol = opts.protocol;
@@ -98,7 +103,7 @@ function ProxyAgent (opts) {
}
// get the proxy `http.Agent` creation function
- var proxyFn = this.proxies[protocol];
+ var proxyFn = proxies[protocol];
if ('function' != typeof proxyFn) {
throw new TypeError('unsupported proxy protocol: "' + protocol + '"');
}

0 comments on commit 20fd5d2

Please sign in to comment.