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

Commit

Permalink
Update agent-base to v6 (#55)
Browse files Browse the repository at this point in the history
- small changes to adapt to new api
- updated proxy dependencies that use agent-base@6
  • Loading branch information
davidpatrick0 authored Oct 7, 2020
1 parent 4af6f5e commit d18c6bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
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

0 comments on commit d18c6bd

Please sign in to comment.