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

superagent-cache

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent-cache - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "superagent-cache",
"version": "1.0.2",
"version": "1.0.3",
"description": "Superagent with flexible built-in caching.",

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

@@ -391,3 +391,3 @@ # superagent-cache

var superagent = require('superagent');
require('superagent-cache)(superagent)
require('superagent-cache')(superagent)
```

@@ -394,0 +394,0 @@

@@ -126,3 +126,6 @@ /**

_this._end(function (err, response){
if(!err && response){
if(err) {
return callbackExecutor(cb, err, response, key);
}
else if(!err && response){
if(curProps.prune){

@@ -160,2 +163,6 @@ response = curProps.prune(response);

this._end(function (err, response){
if (err) {
return callbackExecutor(cb, err, response, key);
}
if(!err && response){

@@ -162,0 +169,0 @@ superagent.cache.del(key, function (){

@@ -7,5 +7,5 @@ var expect = require('expect');

require('../../superagentCache')(superagent, cacheModule);
var app = express();
app.get('/one', function(req, res){

@@ -41,30 +41,2 @@ res.send(200, {key: 'one'});

/*
Custom API items to test:
TEST THAT I CAN PASS IN BOTH A cache-service INSTANCE AS WELL AS A CONFIG THAT WILL BECOME A cache-service INSTANCE
cache-service level api
chainable
superagent functions
.get() should cache done
.post() should not cache done
.put() should invalidate cache done
.del() should invalidate cache done
custom
._end() should not cache done
.responseProp() should chop response done
.prune() should prune response done
.pruneParams() should generate a cache key without certain params done
.pruneOptions() should generate a cache key without certain options done
.expiration() should override all caches' defaultExpirations done
.cacheWhenEmpty() should cache when response is empty done
.doQuery() should allow users to skip querying but still check all caches done
other
.end() callback err param is optional done
various means of adding headers all resolve the same way in the cache key done
*/
describe('Array', function(){

@@ -241,6 +213,16 @@

it('.end() should not set \'err\' callback param on error', function (done) {
superagent
.get('localhost:3000/invalid')
.end(function (err, response){
expect(err).toExist();
done();
}
);
});
});
describe('superagentCache caching tests', function () {
it('.get() ._end() should bypass all caching logic', function (done) {

@@ -330,3 +312,3 @@ superagent

describe('superagentCache background refresh tests', function () {
it('.get() .expiration() .end() background refresh should not work if the chainable is not used', function (done) {

@@ -333,0 +315,0 @@ superagent

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