From 070db861eac2a17386686147fa2c72e7f6e9a849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Thu, 30 Mar 2017 23:39:52 -0700 Subject: [PATCH] fix(freshness): fix regex for cacheControl matching --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 44ad053..da1668b 100644 --- a/index.js +++ b/index.js @@ -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')) {