Socket
Socket
Sign inDemoInstall

make-fetch-happen

Package Overview
Dependencies
Maintainers
7
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-fetch-happen - npm Package Compare versions

Comparing version 9.0.2 to 9.0.3

6

lib/cache/entry.js

@@ -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

17

lib/cache/index.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc