Skip to content
This repository has been archived by the owner on Jun 12, 2022. It is now read-only.

Commit

Permalink
fix(freshness): fix regex for cacheControl matching
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Mar 31, 2017
1 parent 516fd6e commit 070db86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function isStale (res) {
// https://tools.ietf.org/html/rfc7234#section-4.2.1
function freshnessLifetime (res) {
const cacheControl = res.headers.get('Cache-Control') || ''
const maxAgeMatch = cacheControl.match(/(?:s-maxage|max-age):\s*(\d+)/)
const maxAgeMatch = cacheControl.match(/(?:s-maxage|max-age)\s*=\s*(\d+)/)
if (maxAgeMatch) {
return +maxAgeMatch[1]
} else if (res.headers.get('Expires')) {
Expand Down

0 comments on commit 070db86

Please sign in to comment.