How to use the superagent.cache function in superagent

To help you get started, we’ve selected a few superagent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jpodwys / superagent-cache / test / server / api.js View on Github external
beforeEach(function(){
    superagent.cache.flush();
  });
github jpodwys / superagent-cache / test / server / force-update.js View on Github external
beforeEach(function(){
    superagent.cache.flush();
  });
github jpodwys / superagent-cache / test / server / api.js View on Github external
.end(function (err, response, key) {
          superagent.cache.get(key, function (err, response){
            expect(response).toBe(null);
            superagent
              .get('localhost:3001/one')
              .cacheWhenEmpty(false)
              .prune(prune)
              .end(function (err, response, key) {
                superagent.cache.get(key, function (err, response){
                  expect(response).toBe(200);
                  done();
                });
              }
            );
          });
        }
      );
github jpodwys / superagent-cache / test / server / caching.js View on Github external
beforeEach(function(){
    superagent.cache.flush();
  });
github jpodwys / superagent-cache / test / server / background-refresh.js View on Github external
setTimeout(function(){
            superagent.cache.get(key, function (err, response){
              expect(response.body.pruneQuery).toBe('true');
              expect(response.body.otherParams).toBe('false');
              expect(key.indexOf('pruneQuery')).toBe(-1);
              expect(key.indexOf('otherParams')).toBeGreaterThan(-1);
              done();
            });
          }, 1500);
        }
github jpodwys / superagent-cache / test / server / caching.js View on Github external
.end(function (err, response, key){
          expect(response.body.key).toBe('post');
          superagent.cache.get(key, function (err, response) {
            expect(response).toBe(null);
            checkBrowserStorage(key, false, done);
          });
        }
      );
github jpodwys / superagent-cache / test / server / configurability.js View on Github external
.end(function (err, response, key){
          superagent.cache.get(key, function (err, response) {
            expect(response).toNotBe(null);
            expect(response.body.key).toBe('one');
            setTimeout(function(){
              superagent
                .get('localhost:3004/one')
                .end(function (err, response, key){
                  superagent.cache.get(key, function (err, response) {
                    expect(response).toNotBe(null);
                    expect(response.body.key).toBe('one');
                    done();
                  });
                }
              );
            }, 1000);
          });
        }