Socket
Socket
Sign inDemoInstall

cacheable-request

Package Overview
Dependencies
15
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

2

package.json
{
"name": "cacheable-request",
"version": "2.1.0",
"version": "2.1.1",
"description": "Wrap native HTTP requests with RFC compliant cache support",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -24,3 +24,3 @@ # cacheable-request

- Easily plug in your own or third-party storage adapters
- If DB connection fails, cache is automatically bypassed
- If DB connection fails, cache is automatically bypassed ([disabled by default](#optsautomaticfailover))
- Adds cache support to any existing HTTP code with minimal changes

@@ -138,2 +138,9 @@ - Uses [http-cache-semantics](https://github.com/pornel/http-cache-semantics) internally for HTTP RFC 7234 compliance

###### opts.automaticFailover
Type: `boolean`<br>
Default: `false`
When set to `true`, if the DB connection fails we will automatically fallback to a network request. DB errors will still be emitted to notify you of the problem even though the request callback may succeed.
##### cb

@@ -140,0 +147,0 @@

@@ -37,3 +37,4 @@ 'use strict';

cache: true,
strictTtl: false
strictTtl: false,
automaticFailover: false
}, opts);

@@ -128,3 +129,3 @@ opts.headers = lowercaseKeys(opts.headers);

get(opts).catch(err => {
if (!madeRequest) {
if (opts.automaticFailover && !madeRequest) {
makeRequest(opts);

@@ -131,0 +132,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc