Socket
Socket
Sign inDemoInstall

cacheable-request

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable-request - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

16

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

@@ -33,7 +33,7 @@ "license": "MIT",

"clone-response": "^1.0.2",
"get-stream": "^4.0.0",
"get-stream": "^5.1.0",
"http-cache-semantics": "^4.0.0",
"keyv": "^3.0.0",
"lowercase-keys": "^1.0.1",
"normalize-url": "^3.1.0",
"lowercase-keys": "^2.0.0",
"normalize-url": "^4.1.0",
"responselike": "^1.0.2"

@@ -43,12 +43,12 @@ },

"@keyv/sqlite": "^2.0.0",
"ava": "^0.25.0",
"ava": "^1.1.0",
"coveralls": "^3.0.0",
"create-test-server": "2.1.1",
"create-test-server": "3.0.0",
"delay": "^4.0.0",
"eslint-config-xo-lukechilds": "^1.0.0",
"nyc": "^13.0.1",
"nyc": "^14.1.1",
"pify": "^4.0.0",
"sqlite3": "^4.0.2",
"this": "^1.0.2",
"xo": "^0.22.0"
"xo": "^0.23.0"
},

@@ -55,0 +55,0 @@ "xo": {

@@ -44,2 +44,3 @@ 'use strict';

}
opts = {

@@ -61,3 +62,4 @@ headers: {},

stripWWW: false,
removeTrailingSlash: false
removeTrailingSlash: false,
stripAuthentication: false
}

@@ -76,4 +78,6 @@ );

requestErrorCallback = () => {
requestErrored = true;
resolve();
if (!requestErrored) {
requestErrored = true;
resolve();
}
};

@@ -131,4 +135,4 @@ });

await this.cache.set(key, value, ttl);
} catch (err) {
ee.emit('error', new CacheableRequest.CacheError(err));
} catch (error) {
ee.emit('error', new CacheableRequest.CacheError(error));
}

@@ -140,4 +144,4 @@ })();

await this.cache.delete(key);
} catch (err) {
ee.emit('error', new CacheableRequest.CacheError(err));
} catch (error) {
ee.emit('error', new CacheableRequest.CacheError(error));
}

@@ -158,4 +162,4 @@ })();

ee.emit('request', req);
} catch (err) {
ee.emit('error', new CacheableRequest.RequestError(err));
} catch (error) {
ee.emit('error', new CacheableRequest.RequestError(error));
}

@@ -191,11 +195,14 @@ };

this.cache.on('error', err => ee.emit('error', new CacheableRequest.CacheError(err)));
const errorHandler = error => ee.emit('error', new CacheableRequest.CacheError(error));
this.cache.once('error', errorHandler);
ee.on('response', () => this.cache.removeListener('error', errorHandler));
try {
await get(opts);
} catch (err) {
} catch (error) {
if (opts.automaticFailover && !madeRequest) {
makeRequest(opts);
}
ee.emit('error', new CacheableRequest.CacheError(err));
ee.emit('error', new CacheableRequest.CacheError(error));
}

@@ -236,6 +243,6 @@ })();

CacheableRequest.RequestError = class extends Error {
constructor(err) {
super(err.message);
constructor(error) {
super(error.message);
this.name = 'RequestError';
Object.assign(this, err);
Object.assign(this, error);
}

@@ -245,6 +252,6 @@ };

CacheableRequest.CacheError = class extends Error {
constructor(err) {
super(err.message);
constructor(error) {
super(error.message);
this.name = 'CacheError';
Object.assign(this, err);
Object.assign(this, error);
}

@@ -251,0 +258,0 @@ };

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