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

Commit 0b41851

Browse files
committed
Use global agents for no proxy
1 parent 5591296 commit 0b41851

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ var inherits = require('util').inherits;
1111
var debug = require('debug')('proxy-agent');
1212
var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
1313

14-
var HttpAgent = require('http').Agent;
15-
var HttpsAgent = require('https').Agent;
14+
var http = require('http');
15+
var https = require('https');
1616
var PacProxyAgent = require('pac-proxy-agent');
1717
var HttpProxyAgent = require('http-proxy-agent');
1818
var HttpsProxyAgent = require('https-proxy-agent');
@@ -59,10 +59,10 @@ PacProxyAgent.protocols.forEach(function (protocol) {
5959
function httpOrHttps(opts, secureEndpoint) {
6060
if (secureEndpoint) {
6161
// HTTPS
62-
return new HttpsAgent();
62+
return https.globalAgent;
6363
} else {
6464
// HTTP
65-
return new HttpAgent()
65+
return http.globalAgent;
6666
}
6767
}
6868

0 commit comments

Comments
 (0)