make-fetch-happen
Advanced tools
Comparing version 7.0.0 to 7.1.0
16
agent.js
'use strict' | ||
const LRU = require('lru-cache') | ||
const url = require('url') | ||
const isLambda = require('is-lambda') | ||
@@ -47,2 +48,11 @@ const AGENT_CACHE = new LRU({ max: 50 }) | ||
// keep alive in AWS lambda makes no sense | ||
const lambdaAgent = !isLambda ? null | ||
: isHttps ? require('https').globalAgent | ||
: require('http').globalAgent | ||
if (isLambda && !pxuri) { | ||
return lambdaAgent | ||
} | ||
if (AGENT_CACHE.peek(key)) { | ||
@@ -53,3 +63,7 @@ return AGENT_CACHE.get(key) | ||
if (pxuri) { | ||
const proxy = getProxy(pxuri, opts, isHttps) | ||
const pxopts = isLambda ? { | ||
...opts, | ||
agent: lambdaAgent | ||
} : opts | ||
const proxy = getProxy(pxuri, pxopts, isHttps) | ||
AGENT_CACHE.set(key, proxy) | ||
@@ -56,0 +70,0 @@ return proxy |
@@ -5,2 +5,9 @@ # Changelog | ||
## [7.1.0](https://github.com/npm/make-fetch-happen/compare/v7.0.0...v7.1.0) (2019-12-17) | ||
### Features | ||
* use globalAgent when in lambda ([bd9409d](https://github.com/npm/make-fetch-happen/commit/bd9409da246a979b665ebd23967ec01dd928ce47)), closes [#4](https://github.com/npm/make-fetch-happen/issues/4) | ||
## [7.0.0](https://github.com/npm/make-fetch-happen/compare/v6.1.0...v7.0.0) (2019-12-17) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "make-fetch-happen", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "Opinionated, caching, retrying fetch client", | ||
@@ -41,2 +41,3 @@ "main": "index.js", | ||
"https-proxy-agent": "^4.0.0", | ||
"is-lambda": "^1.0.1", | ||
"lru-cache": "^5.1.1", | ||
@@ -43,0 +44,0 @@ "minipass": "^3.0.0", |
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
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
71451
891
15
25
+ Addedis-lambda@^1.0.1
+ Addedis-lambda@1.0.1(transitive)