@quintype/framework 7.34.6 → 7.34.7-handle-500-issue.1
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
|
@@ -125,7 +125,7 @@ function loadDataForPageType(
|
|
|
125
125
|
.then((result) => {
|
|
126
126
|
if (result && result.data) {
|
|
127
127
|
if (result.data[ABORT_HANDLER] || (result.data.error && result.data.error.message)) {
|
|
128
|
-
return null
|
|
128
|
+
return null;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
return result;
|
|
@@ -485,6 +485,14 @@ exports.handleIsomorphicRoute = function handleIsomorphicRoute(
|
|
|
485
485
|
});
|
|
486
486
|
return res.redirect(301, result.data.location);
|
|
487
487
|
}
|
|
488
|
+
|
|
489
|
+
// For server errors (>=500),send statuss
|
|
490
|
+
if (statusCode >= 500) {
|
|
491
|
+
res.status(statusCode);
|
|
492
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
493
|
+
return res.sendStatus(statusCode);
|
|
494
|
+
}
|
|
495
|
+
|
|
488
496
|
const seoInstance = getSeoInstance(seo, config, result.pageType);
|
|
489
497
|
const seoTags = seoInstance && seoInstance.getMetaTags(config, result.pageType || match.pageType, result, { url });
|
|
490
498
|
|
|
@@ -168,17 +168,7 @@ describe("Isomorphic Handler", function () {
|
|
|
168
168
|
}),
|
|
169
169
|
}
|
|
170
170
|
);
|
|
171
|
-
|
|
172
|
-
supertest(app)
|
|
173
|
-
.get("/")
|
|
174
|
-
.expect("Content-Type", /html/)
|
|
175
|
-
.expect(500)
|
|
176
|
-
.then((res) => {
|
|
177
|
-
const response = JSON.parse(res.text);
|
|
178
|
-
assert.equal('<div data-page-type="not-found">foobar</div>', response.content);
|
|
179
|
-
assert.equal(true, response.store.qt.disableIsomorphicComponent);
|
|
180
|
-
})
|
|
181
|
-
.then(done, done);
|
|
171
|
+
supertest(app).get("/").expect(500, done);
|
|
182
172
|
});
|
|
183
173
|
|
|
184
174
|
it("Throws a 500 if loadData and loadErrorData both crash", function (done) {
|
|
@@ -194,7 +184,7 @@ describe("Isomorphic Handler", function () {
|
|
|
194
184
|
}
|
|
195
185
|
);
|
|
196
186
|
|
|
197
|
-
supertest(app).get("/").expect(
|
|
187
|
+
supertest(app).get("/").expect(500, done);
|
|
198
188
|
});
|
|
199
189
|
|
|
200
190
|
it("Cache headers are set", function (done) {
|