Release v2.15.5
This commit is contained in:
1 parent
0e77998e92
commit
2fd059d35a
18 files changed
+385
-30
No files matched your search
@@ -25,9 +25,10 @@ module.exports = function registerErrorPageMiddleware(app, pages) {
|
||||
|
||||
res.send = function (body) {
|
||||
const statusCode = Number(res.statusCode) || 200;
|
||||
const isHtml = typeof body === 'string' && /^\s*</.test(body);
|
||||
const isStringBody = typeof body === 'string';
|
||||
const isHtml = isStringBody && /^\s*</.test(body);
|
||||
|
||||
if (statusCode >= 400 && statusCode < 600 && !isHtml && wantsHtmlErrorPage(req, res)) {
|
||||
if (statusCode >= 400 && statusCode < 600 && isStringBody && !isHtml && wantsHtmlErrorPage(req, res)) {
|
||||
return send.call(res, createErrorPage(pages, req, statusCode, body));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user