ez-indexation / app / node_modules / fresh /
@kieffer kieffer authored on 7 Mar 2017
..
HISTORY.md v0.0.0 7 years ago
LICENSE v0.0.0 7 years ago
README.md v0.0.0 7 years ago
index.js v0.0.0 7 years ago
package.json v0.0.0 7 years ago
README.md

fresh

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

HTTP response freshness testing

Installation

$ npm install fresh

API

var fresh = require('fresh')

fresh(req, res)

Check freshness of req and res headers.

When the cache is "fresh" true is returned, otherwise false is returned to indicate that the cache is now stale.

Example

var req = { 'if-none-match': 'tobi' };
var res = { 'etag': 'luna' };
fresh(req, res);
// => false

var req = { 'if-none-match': 'tobi' };
var res = { 'etag': 'tobi' };
fresh(req, res);
// => true

License

MIT