http-cache-semantics
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -31,2 +31,5 @@ 'use strict'; | ||
} | ||
if (!parts.length) { | ||
return undefined; | ||
} | ||
return parts.join(', '); | ||
@@ -72,2 +75,3 @@ } | ||
this._resHeaders = Object.assign({}, this._resHeaders, {'cache-control': formatCacheControl(this._rescc)}); | ||
delete this._resHeaders['expires']; | ||
delete this._resHeaders['pragma']; | ||
@@ -74,0 +78,0 @@ } |
{ | ||
"name": "http-cache-semantics", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Parses Cache-Control headers and friends", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -68,2 +68,17 @@ 'use strict'; | ||
it('pre-check poison undefined header', function() { | ||
const origCC = 'pre-check=0, post-check=0, no-cache, no-store'; | ||
const res = {headers:{'cache-control': origCC, expires: 'yesterday!'}}; | ||
const cache = new CachePolicy(req, res, {ignoreCargoCult:true}); | ||
assert(cache.stale()); | ||
assert(cache.storable()); | ||
assert.equal(cache.maxAge(), 0); | ||
const cc = cache.responseHeaders()['cache-control']; | ||
assert(!cc); | ||
assert(res.headers['expires']); | ||
assert(!cache.responseHeaders()['expires']); | ||
}); | ||
it('cache with expires', function() { | ||
@@ -70,0 +85,0 @@ const cache = new CachePolicy(req, {headers:{ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78011
725