diff --git a/index.js b/index.js index 6a76d41..a9b2f5d 100644 --- a/index.js +++ b/index.js @@ -56,15 +56,17 @@ function ElectronProxyAgent(session, username, password) { } } - Agent.call(this, connect); + instance = Agent.call(this, connect); - this.session = session; + instance.session = session; - this.cache = this._resolver = null; - this.credentials = { + instance.cache = instance._resolver = null; + instance.credentials = { username: username, password: password }; + + return instance; } inherits(ElectronProxyAgent, Agent); @@ -107,7 +109,7 @@ function connect (req, opts, fn) { } debug('url: %o', url); - self.session.resolveProxy(url, onproxy); + self.session.resolveProxy(url).then(onproxy); // `resolveProxy()` callback function function onproxy (proxy) { diff --git a/package.json b/package.json index 1d05caa..8b9aa50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron-proxy-agent", - "version": "2.0.0", + "version": "2.0.1", "description": "NodeJS http(s).Agent implementation for electron shell", "main": "index.js", "repository": {