Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expired

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expired - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

2

package.json
{
"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",

@@ -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 @@

@@ -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();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc