make-fetch-happen
Advanced tools
Comparing version 9.0.2 to 9.0.3
@@ -148,2 +148,8 @@ const { Request, Response } = require('minipass-fetch') | ||
// a cache mode of 'reload' means to behave as though we have no cache | ||
// on the way to the network. return undefined to allow cacheFetch to | ||
// create a brand new request no matter what. | ||
if (options.cache === 'reload') | ||
return | ||
// find the specific entry that satisfies the request | ||
@@ -150,0 +156,0 @@ let match |
@@ -10,3 +10,3 @@ const { NotCachedError } = require('./errors.js') | ||
if (!entry) { | ||
// no cached result, if the cache mode is only-if-cached that's a failure | ||
// no cached result, if the cache mode is 'only-if-cached' that's a failure | ||
if (options.cache === 'only-if-cached') | ||
@@ -21,11 +21,10 @@ throw new NotCachedError(request.url) | ||
// we have a cached response that satisfies this request, however | ||
// if the cache mode is reload the user explicitly wants us to revalidate | ||
if (options.cache === 'reload') | ||
// we have a cached response that satisfies this request, however if the cache | ||
// mode is 'no-cache' then we send the revalidation request no matter what | ||
if (options.cache === 'no-cache') | ||
return entry.revalidate(request, options) | ||
// if the cache mode is either force-cache or only-if-cached we will only | ||
// respond with a cached entry, even if it's stale. set the status to the | ||
// appropriate value based on whether revalidation is needed and respond | ||
// from the cache | ||
// if the cached entry is not stale, or if the cache mode is 'force-cache' or | ||
// 'only-if-cached' we can respond with the cached entry. set the status | ||
// based on the result of needsRevalidation and respond | ||
const _needsRevalidation = entry.policy.needsRevalidation(request) | ||
@@ -37,3 +36,3 @@ if (options.cache === 'force-cache' || | ||
// cache entry might be stale, revalidate it and return a response | ||
// if we got here, the cache entry is stale so revalidate it | ||
return entry.revalidate(request, options) | ||
@@ -40,0 +39,0 @@ } |
{ | ||
"name": "make-fetch-happen", | ||
"version": "9.0.2", | ||
"version": "9.0.3", | ||
"description": "Opinionated, caching, retrying fetch client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
56396
984
12