@quintype/framework 7.34.7-handle-500-issue.2 → 7.34.7-handle-500-issue.3

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.34.7-handle-500-issue.2",
3
+ "version": "7.34.7-handle-500-issue.3",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -42,7 +42,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
42
42
  } else {
43
43
  res.setHeader(
44
44
  "Cache-Control",
45
- `public,max-age=${maxAge},s-maxage=120,stale-while-revalidate=120,stale-if-error=120`
45
+ `public,max-age=${maxAge},s-maxage=${sMaxAge},stale-while-revalidate=1000,stale-if-error=${STALE_IF_ERROR_CACHE_DURATION}`
46
46
  );
47
47
  }
48
48
 
@@ -486,7 +486,6 @@ exports.handleIsomorphicRoute = function handleIsomorphicRoute(
486
486
  return res.redirect(301, result.data.location);
487
487
  }
488
488
 
489
- // For server errors (>=500),send statuss
490
489
  if (statusCode >= 500) {
491
490
  return res.sendStatus(statusCode);
492
491
  }
@@ -121,7 +121,7 @@ describe("Custom Route Handler", function () {
121
121
  supertest(app)
122
122
  .get("/moved-permanently")
123
123
  .expect("Location", "/permanent-location")
124
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
124
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
125
125
  .expect("Vary", /Accept\-Encoding/)
126
126
  .expect("Surrogate-Key", "sp/42/101")
127
127
  .expect("Cache-Tag", "sp/42/101")
@@ -136,7 +136,7 @@ describe("Custom Route Handler", function () {
136
136
  supertest(app)
137
137
  .get("/moved-temporarily")
138
138
  .expect("Location", "/temporary-location")
139
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
139
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
140
140
  .expect("Vary", /Accept\-Encoding/)
141
141
  .expect("Surrogate-Key", "sp/42/102")
142
142
  .expect("Cache-Tag", "sp/42/102")
@@ -152,7 +152,7 @@ describe("Custom Route Handler", function () {
152
152
  supertest(app)
153
153
  .get("/static-with-header-footer")
154
154
  .expect("Content-Type", /html/)
155
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
155
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
156
156
  .expect("Vary", "Accept-Encoding")
157
157
  .expect("Surrogate-Key", "sp/42/103")
158
158
  .expect("Cache-Tag", "sp/42/103")
@@ -174,7 +174,7 @@ describe("Custom Route Handler", function () {
174
174
  supertest(app)
175
175
  .get("/static-without-header-footer")
176
176
  .expect("Content-Type", /html/)
177
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
177
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
178
178
  .expect("Vary", "Accept-Encoding")
179
179
  .expect("Surrogate-Key", "sp/42/104")
180
180
  .expect("Cache-Tag", "sp/42/104")
@@ -236,7 +236,7 @@ describe("Custom Route Handler", function () {
236
236
  supertest(app)
237
237
  .get("/moved-absolute")
238
238
  .expect("Location", "https://www.google.com")
239
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
239
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
240
240
  .expect("Vary", /Accept\-Encoding/)
241
241
  .expect("Surrogate-Key", "sp/42/105")
242
242
  .expect("Cache-Tag", "sp/42/105")
@@ -250,7 +250,7 @@ describe("Custom Route Handler", function () {
250
250
  );
251
251
  supertest(app)
252
252
  .get("/static-with-mime-type")
253
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
253
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
254
254
  .expect("Vary", /Accept\-Encoding/)
255
255
  .expect("Surrogate-Key", "sp/42/105")
256
256
  .expect("Cache-Tag", "sp/42/105")
@@ -265,7 +265,7 @@ describe("Custom Route Handler", function () {
265
265
  );
266
266
  supertest(app)
267
267
  .get("/static-without-header-footer")
268
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
268
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
269
269
  .expect("Vary", "Accept-Encoding")
270
270
  .expect("Surrogate-Key", "sp/42/104")
271
271
  .expect("Cache-Tag", "sp/42/104")
@@ -200,7 +200,7 @@ describe("Isomorphic Handler", function () {
200
200
  supertest(app)
201
201
  .get("/")
202
202
  .expect("Content-Type", /html/)
203
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
203
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
204
204
  .expect("Vary", "Accept-Encoding")
205
205
  .expect("Surrogate-Key", "foo bar")
206
206
  .expect("Cache-Tag", "foo,bar")
@@ -503,7 +503,7 @@ describe("Isomorphic Handler", function () {
503
503
  .then((res) => {
504
504
  const cacheControl = res.header["cache-control"];
505
505
  const cacheTag = res.header["cache-tag"];
506
- assert.equal(cacheControl, "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120");
506
+ assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
507
507
  assert.equal(cacheTag, "c/1/abcdefgh");
508
508
  })
509
509
  .then(done);
@@ -631,7 +631,7 @@ describe("Isomorphic Handler", function () {
631
631
  const cacheControl = res.header["cache-control"];
632
632
  const edgeCacheTag = res.header["edge-cache-tag"];
633
633
  const contentSecurityPolicy = res.header["content-security-policy"];
634
- assert.equal(cacheControl, "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120");
634
+ assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
635
635
  assert.equal(edgeCacheTag, "c/1/abcdefgh");
636
636
  assert.equal(
637
637
  contentSecurityPolicy,
@@ -670,7 +670,7 @@ describe("Isomorphic Handler", function () {
670
670
  const cacheControl = res.header["cache-control"];
671
671
  const edgeCacheTag = res.header["edge-cache-tag"];
672
672
  const contentSecurityPolicy = res.header["content-security-policy"];
673
- assert.equal(cacheControl, "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120");
673
+ assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
674
674
  assert.equal(edgeCacheTag, "c/1/abcdefgh");
675
675
  assert.equal(
676
676
  contentSecurityPolicy,
@@ -706,7 +706,10 @@ describe("Isomorphic Handler", function () {
706
706
  .expect(200)
707
707
  .then((res) => {
708
708
  const cacheControl = res.header["cache-control"];
709
- assert.equal(cacheControl, "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120");
709
+ assert.equal(
710
+ cacheControl,
711
+ "public,max-age=15,s-maxage=1800,stale-while-revalidate=1000,stale-if-error=14400"
712
+ );
710
713
  })
711
714
  .then(done);
712
715
  });
@@ -727,7 +730,7 @@ describe("Isomorphic Handler", function () {
727
730
  .expect(200)
728
731
  .then((res) => {
729
732
  const cacheControl = res.header["cache-control"];
730
- assert.equal(cacheControl, "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120");
733
+ assert.equal(cacheControl, "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400");
731
734
  })
732
735
  .then(done);
733
736
  });
@@ -619,7 +619,7 @@ describe("Redirect Routes Handler", function () {
619
619
  supertest(app)
620
620
  .get("/moved-temporarily-1")
621
621
  .expect("Location", "/temporarily-location-1")
622
- .expect("Cache-Control", "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120")
622
+ .expect("Cache-Control", "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400")
623
623
  .expect("Vary", /Accept\-Encoding/)
624
624
  .expect("Surrogate-Key", "sp/42/102")
625
625
  .expect("Cache-Tag", "sp/42/102")