Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Updates agent-base to v6 #55

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function mapOptsToProxy(opts) {
function ProxyAgent (opts) {
if (!(this instanceof ProxyAgent)) return new ProxyAgent(opts);
debug('creating new ProxyAgent instance: %o', opts);
Agent.call(this, connect);
Agent.call(this);

if (opts) {
var proxy = mapOptsToProxy(opts);
Expand All @@ -159,7 +159,7 @@ inherits(ProxyAgent, Agent);
*
*/

function connect (req, opts, fn) {
ProxyAgent.prototype.callback = function(req, opts, fn) {
var proxyOpts = this.proxy;
var proxyUri = this.proxyUri;
var proxyFn = this.proxyFn;
Expand Down Expand Up @@ -193,6 +193,8 @@ function connect (req, opts, fn) {
agent.addRequest(req, opts);
} else {
// XXX: agent.callback() is an agent-base-ism
agent.callback(req, opts, fn);
agent.callback(req, opts)
.then(function(socket) { fn(null, socket); })
.catch(function(error) { fn(error); });
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
},
"homepage": "https://github.com/TooTallNate/node-proxy-agent",
"dependencies": {
"agent-base": "^4.2.0",
"agent-base": "^6.0.0",
"debug": "4",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^3.0.0",
"http-proxy-agent": "^4.0.0",
"https-proxy-agent": "^5.0.0",
"lru-cache": "^5.1.1",
"pac-proxy-agent": "^3.0.1",
"pac-proxy-agent": "^4.1.0",
"proxy-from-env": "^1.0.0",
"socks-proxy-agent": "^4.0.1"
"socks-proxy-agent": "^5.0.0"
},
"devDependencies": {
"@types/agent-base": "^4.2.0",
Expand Down