make-fetch-happen
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.6.0"></a> | ||
# [1.6.0](https://github.com/zkat/make-fetch-happen/compare/v1.5.1...v1.6.0) (2017-04-06) | ||
### Features | ||
* **agent:** better, keepalive-supporting, default http agents ([16277f6](https://github.com/zkat/make-fetch-happen/commit/16277f6)) | ||
<a name="1.5.1"></a> | ||
@@ -7,0 +17,0 @@ ## [1.5.1](https://github.com/zkat/make-fetch-happen/compare/v1.5.0...v1.5.1) (2017-04-05) |
21
index.js
@@ -5,4 +5,2 @@ 'use strict' | ||
const fetch = require('node-fetch') | ||
const http = require('http') | ||
const https = require('https') | ||
let ProxyAgent | ||
@@ -13,3 +11,2 @@ const pkg = require('./package.json') | ||
const Stream = require('stream') | ||
const url = require('url') | ||
@@ -316,2 +313,4 @@ // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch | ||
let httpsAgent | ||
let httpAgent | ||
function getAgent (uri, opts) { | ||
@@ -326,6 +325,14 @@ if (opts.agent != null) { | ||
return new ProxyAgent(opts.proxy) | ||
} else if (url.parse(uri).protocol === 'https:') { | ||
return https.globalAgent | ||
} else if (url.parse(uri).protocol === 'http:') { | ||
return http.globalAgent | ||
} else if (uri.trim().startsWith('https:')) { | ||
if (!httpsAgent) { | ||
const Agent = require('agentkeepalive').HttpsAgent | ||
httpsAgent = new Agent({maxSockets: 15}) | ||
} | ||
return httpsAgent | ||
} else { | ||
if (!httpAgent) { | ||
const Agent = require('agentkeepalive') | ||
httpAgent = new Agent({maxSockets: 15}) | ||
} | ||
return httpAgent | ||
} | ||
@@ -332,0 +339,0 @@ } |
{ | ||
"name": "make-fetch-happen", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "Opinionated, caching, retrying fetch client", | ||
@@ -36,2 +36,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"agentkeepalive": "^3.1.0", | ||
"bluebird": "^3.5.0", | ||
@@ -38,0 +39,0 @@ "cacache": "^7.0.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
39265
569
10
11
+ Addedagentkeepalive@^3.1.0
+ Addedagentkeepalive@3.5.3(transitive)
+ Addedhumanize-ms@1.2.1(transitive)