@quintype/framework 7.23.1 → 7.23.2-update-cache-headers.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.23.1",
3
+ "version": "7.23.2-update-cache-headers.0",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -34,7 +34,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
34
34
  );
35
35
  } else {
36
36
  if (networkOnly) {
37
- res.setHeader("Cache-Control", `public,s-maxage=${sMaxAge}`);
37
+ res.setHeader("Cache-Control", `public,s-maxage=${sMaxAge},stale-while-revalidate=1000, stale-if-error=14400`);
38
38
  res.setHeader(
39
39
  "Cloudflare-CDN-Cache-Control",
40
40
  `max-age=${sMaxAge}, stale-while-revalidate=1000, stale-if-error=14400`
@@ -39,7 +39,7 @@ async function generateServiceWorker(
39
39
  res
40
40
  .status(200)
41
41
  .header("Content-Type", "application/javascript")
42
- .header("Cache-Control", "public,max-age=300")
42
+ .header("Cache-Control", "public,max-age=300, stale-while-revalidate=1000, stale-if-error=14400")
43
43
  .header("Vary", "Accept-Encoding")
44
44
  .header(
45
45
  "Cache-Tag",
@@ -9,7 +9,7 @@ exports.handleManifest = function handleManifest(
9
9
  ) {
10
10
  return new Promise((resolve) => resolve(manifestFn(config, domainSlug)))
11
11
  .then((result) => {
12
- res.setHeader("Cache-Control", "public,max-age=900");
12
+ res.setHeader("Cache-Control", "public,max-age=900,stale-while-revalidate=1000, stale-if-error=14400");
13
13
  res.setHeader("Vary", "Accept-Encoding");
14
14
  res.json(
15
15
  Object.assign(
@@ -158,7 +158,7 @@ describe("Isomorphic Data Load", function () {
158
158
  .expect("Content-Type", /json/)
159
159
  .expect(
160
160
  "Cache-Control",
161
- "public,s-maxage=900"
161
+ "public,s-maxage=900,stale-while-revalidate=1000, stale-if-error=14400",
162
162
  )
163
163
  .expect("Vary", "Accept-Encoding")
164
164
  .expect("Cache-Tag", "foo,bar")