proxy-agent
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -82,2 +82,5 @@ "use strict"; | ||
this.connectOpts = opts; | ||
this.httpAgent = opts?.httpAgent || new http.Agent(opts); | ||
this.httpsAgent = | ||
opts?.httpsAgent || new https.Agent(opts); | ||
} | ||
@@ -91,3 +94,3 @@ async connect(req, opts) { | ||
debug('Proxy not enabled for URL: %o', url); | ||
return opts.secureEndpoint ? https.globalAgent : http.globalAgent; | ||
return opts.secureEndpoint ? this.httpsAgent : this.httpAgent; | ||
} | ||
@@ -94,0 +97,0 @@ debug('Request URL: %o', url); |
@@ -17,3 +17,16 @@ /// <reference types="node" /> | ||
}; | ||
export type ProxyAgentOptions = HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & PacProxyAgentOptions<''>; | ||
export type ProxyAgentOptions = HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & PacProxyAgentOptions<''> & { | ||
/** | ||
* Default `http.Agent` instance to use when no proxy is | ||
* configured for a request. Defaults to a new `http.Agent()` | ||
* instance with the proxy agent options passed in. | ||
*/ | ||
httpAgent?: http.Agent; | ||
/** | ||
* Default `http.Agent` instance to use when no proxy is | ||
* configured for a request. Defaults to a new `https.Agent()` | ||
* instance with the proxy agent options passed in. | ||
*/ | ||
httpsAgent?: http.Agent; | ||
}; | ||
/** | ||
@@ -32,2 +45,4 @@ * Uses the appropriate `Agent` subclass based off of the "proxy" | ||
connectOpts?: ProxyAgentOptions; | ||
httpAgent: http.Agent; | ||
httpsAgent: http.Agent; | ||
constructor(opts?: ProxyAgentOptions); | ||
@@ -34,0 +49,0 @@ connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<http.Agent>; |
@@ -82,2 +82,5 @@ "use strict"; | ||
this.connectOpts = opts; | ||
this.httpAgent = opts?.httpAgent || new http.Agent(opts); | ||
this.httpsAgent = | ||
opts?.httpsAgent || new https.Agent(opts); | ||
} | ||
@@ -91,3 +94,3 @@ async connect(req, opts) { | ||
debug('Proxy not enabled for URL: %o', url); | ||
return opts.secureEndpoint ? https.globalAgent : http.globalAgent; | ||
return opts.secureEndpoint ? this.httpsAgent : this.httpAgent; | ||
} | ||
@@ -94,0 +97,0 @@ debug('Request URL: %o', url); |
{ | ||
"name": "proxy-agent", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Maps proxy protocols to `http.Agent` implementations", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20791
294
8