Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reliable-get

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reliable-get - npm Package Compare versions

Comparing version 0.1.29 to 0.1.30

4

index.js

@@ -84,3 +84,5 @@ 'use strict';

res.headers = res.headers || {};
res.headers['cache-control'] = 'no-cache, no-store, must-revalidate';
if (!hasCacheControl(res, 'no-cache') || !hasCacheControl(res, 'no-store')) {
res.headers['cache-control'] = 'no-cache, no-store, must-revalidate';
}
next(null, {statusCode: res.statusCode, content: res.content, headers: res.headers, timing: res.timing});

@@ -87,0 +89,0 @@ });

{
"name": "reliable-get",
"version": "0.1.29",
"version": "0.1.30",
"description": "A circuit breaker and cached wrapper for GET requests (enables reliable external service interaction).",

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

@@ -69,2 +69,13 @@ 'use strict';

it('NO CACHE: should just request service if explicitNoCache', function(done) {
var config = {cache:{engine:'nocache'}};
var rg = new ReliableGet(config);
rg.get({url:'http://localhost:5001/nocachecustom', explicitNoCache: true}, function(err, response) {
expect(err).to.be(null);
expect(response.headers['cache-control']).to.be('no-cache, no-store, must-revalidate, private, max-stale=0, post-check=0, pre-check=0');
expect(response.statusCode).to.be(200);
done();
});
});
it('NO CACHE: should fail if timeout exceeded', function(done) {

@@ -229,2 +240,3 @@ var config = {cache:{engine:'nocache'}};

expect(response.statusCode).to.be(200);
expect(response.headers['cache-control']).to.be('private, max-age=0, no-cache');
var content = response.content;

@@ -234,2 +246,3 @@ setTimeout(function() {

expect(response.statusCode).to.be(200);
expect(response.headers['cache-control']).to.be('private, max-age=0, no-cache');
expect(response.content).to.not.be(content);

@@ -236,0 +249,0 @@ done();

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

router.get('/nocachecustom', function(req, res) {
res.writeHead(200, {'cache-control': 'no-cache, no-store, must-revalidate, private, max-stale=0, post-check=0, pre-check=0'});
res.end('' + Date.now());
});
router.get('/maxage', function(req, res) {

@@ -46,0 +51,0 @@ res.writeHead(200, {'cache-control': 'private, max-age=5000'});

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