Sha256: 940950bbabe818d7a37d16ed250889d9721909303b49c6af4f2ef46a48635aef

Contents?: true

Size: 1.42 KB

Versions: 17

Compression:

Stored size: 1.42 KB

Contents

# fresh

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]

HTTP response freshness testing

## Installation

```
$ npm install fresh
```

## API

```js
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

```js
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](LICENSE)

[npm-image]: https://img.shields.io/npm/v/fresh.svg?style=flat
[npm-url]: https://npmjs.org/package/fresh
[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
[node-version-url]: http://nodejs.org/download/
[travis-image]: https://img.shields.io/travis/jshttp/fresh.svg?style=flat
[travis-url]: https://travis-ci.org/jshttp/fresh
[coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh.svg?style=flat
[coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master
[downloads-image]: https://img.shields.io/npm/dm/fresh.svg?style=flat
[downloads-url]: https://npmjs.org/package/fresh

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/fresh/README.md