fresh 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/HISTORY.md CHANGED
@@ -1,24 +1,38 @@
1
+ 0.3.0 / 2015-05-12
2
+ ==================
3
+
4
+ * Add weak `ETag` matching support
5
+
1
6
  0.2.4 / 2014-09-07
2
7
  ==================
3
8
 
4
- * Support Node.js 0.6
9
+ * Support Node.js 0.6
5
10
 
6
11
  0.2.3 / 2014-09-07
7
12
  ==================
8
13
 
9
- * Move repository to jshttp
14
+ * Move repository to jshttp
10
15
 
11
16
  0.2.2 / 2014-02-19
12
17
  ==================
13
18
 
14
- * Revert "Fix for blank page on Safari reload"
19
+ * Revert "Fix for blank page on Safari reload"
15
20
 
16
21
  0.2.1 / 2014-01-29
17
22
  ==================
18
23
 
19
- * fix: support max-age=0 for end-to-end revalidation
24
+ * Fix for blank page on Safari reload
20
25
 
21
26
  0.2.0 / 2013-08-11
22
27
  ==================
23
28
 
24
- * fix: return false for no-cache
29
+ * Return stale for `Cache-Control: no-cache`
30
+
31
+ 0.1.0 / 2012-06-15
32
+ ==================
33
+ * Add `If-None-Match: *` support
34
+
35
+ 0.0.1 / 2012-06-10
36
+ ==================
37
+
38
+ * Initial release
package/README.md CHANGED
@@ -46,13 +46,13 @@ fresh(req, res);
46
46
 
47
47
  [MIT](LICENSE)
48
48
 
49
- [npm-image]: https://img.shields.io/npm/v/fresh.svg?style=flat
49
+ [npm-image]: https://img.shields.io/npm/v/fresh.svg
50
50
  [npm-url]: https://npmjs.org/package/fresh
51
- [node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
51
+ [node-version-image]: https://img.shields.io/node/v/fresh.svg
52
52
  [node-version-url]: http://nodejs.org/download/
53
- [travis-image]: https://img.shields.io/travis/jshttp/fresh.svg?style=flat
53
+ [travis-image]: https://img.shields.io/travis/jshttp/fresh/master.svg
54
54
  [travis-url]: https://travis-ci.org/jshttp/fresh
55
- [coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh.svg?style=flat
55
+ [coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh/master.svg
56
56
  [coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master
57
- [downloads-image]: https://img.shields.io/npm/dm/fresh.svg?style=flat
57
+ [downloads-image]: https://img.shields.io/npm/dm/fresh.svg
58
58
  [downloads-url]: https://npmjs.org/package/fresh
package/index.js CHANGED
@@ -40,7 +40,11 @@ function fresh(req, res) {
40
40
  if (noneMatch) noneMatch = noneMatch.split(/ *, */);
41
41
 
42
42
  // if-none-match
43
- if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0];
43
+ if (noneMatch) {
44
+ etagMatches = noneMatch.some(function (match) {
45
+ return match === '*' || match === etag || match === 'W/' + etag;
46
+ });
47
+ }
44
48
 
45
49
  // if-modified-since
46
50
  if (modifiedSince) {
@@ -50,4 +54,4 @@ function fresh(req, res) {
50
54
  }
51
55
 
52
56
  return !! (etagMatches && notModified);
53
- }
57
+ }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "fresh",
3
3
  "description": "HTTP response freshness testing",
4
- "version": "0.2.4",
4
+ "version": "0.3.0",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
6
+ "contributors": [
7
+ "Douglas Christopher Wilson <doug@somethingdoug.com>",
8
+ "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
9
+ ],
6
10
  "license": "MIT",
7
11
  "keywords": [
8
12
  "fresh",
@@ -12,9 +16,8 @@
12
16
  ],
13
17
  "repository": "jshttp/fresh",
14
18
  "devDependencies": {
15
- "istanbul": "0",
16
- "mocha": "1",
17
- "should": "3"
19
+ "istanbul": "0.3.9",
20
+ "mocha": "1.21.5"
18
21
  },
19
22
  "files": [
20
23
  "HISTORY.md",
@@ -25,8 +28,8 @@
25
28
  "node": ">= 0.6"
26
29
  },
27
30
  "scripts": {
28
- "test": "mocha --reporter spec --require should",
29
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should",
30
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --require should"
31
+ "test": "mocha --reporter spec --bail --check-leaks test/",
32
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
33
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
31
34
  }
32
35
  }