+1
-1
| { | ||
| "name": "expired", | ||
| "version": "1.3.0", | ||
| "version": "1.3.1", | ||
| "description": "Calculate when HTTP responses expire from the cache headers", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
+3
-9
@@ -7,3 +7,3 @@ # expired | ||
| `expired` accepts HTTP headers as an argument and will return information on when the resource will expire. `Cache-Control` and `Expires` headers are supported, if both exist `Cache-Control` takes priority. | ||
| `expired` accepts HTTP headers as an argument and will return information on when the resource will expire. `Cache-Control` and `Expires` headers are supported, if both exist `Cache-Control` takes priority ([Why?](http://stackoverflow.com/a/7549558/5625059)). | ||
@@ -22,3 +22,2 @@ ## Install | ||
| const headers = ` | ||
| Access-Control-Allow-Origin: * | ||
| Age: 0 | ||
@@ -29,5 +28,3 @@ Cache-Control: public, max-age=300 | ||
| Date: Fri, 23 Dec 2016 05:50:31 GMT | ||
| Last-Modified: Fri, 23 Dec 2016 05:23:23 GMT | ||
| Vary: Accept-Encoding, User-Agent | ||
| Via: 1.1 varnish-v4`; | ||
| Last-Modified: Fri, 23 Dec 2016 05:23:23 GMT`; | ||
@@ -63,3 +60,2 @@ expired(headers); | ||
| const headers = { | ||
| 'access-control-allow-origin': '*', | ||
| 'age': '0', | ||
@@ -70,5 +66,3 @@ 'cache-control': 'public, max-age=300', | ||
| 'date': 'Fri, 23 Dec 2016 05:50:31 GMT', | ||
| 'last-modified': 'Fri, 23 Dec 2016 05:23:23 GMT', | ||
| 'vary': 'Accept-Encoding, User-Agent', | ||
| 'via': '1.1 varnish-v4' | ||
| 'last-modified': 'Fri, 23 Dec 2016 05:23:23 GMT' | ||
| }; | ||
@@ -75,0 +69,0 @@ |
+13
-0
@@ -42,1 +42,14 @@ import test from 'ava'; | ||
| }); | ||
| test('headers can contain status code', t => { | ||
| const date = new Date().toUTCString(); | ||
| const headers = ` | ||
| HTTP/1.1 200 OK | ||
| Date: ${date} | ||
| Age: 0 | ||
| Cache-Control public, max-age=0`; | ||
| tk.freeze(date); | ||
| t.true(isEqual(expired.on(headers), date)); | ||
| tk.reset(); | ||
| }); |
13086
1%247
4.66%101
-5.61%