From a7acd9e1f4aa8f7c62c3715e711c10f1eeb0e7db Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 23 Aug 2024 22:47:27 +0200 Subject: [PATCH] Replace "callServerError" with "res.error" in the core middleware. --- src/middleware/core.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/middleware/core.js b/src/middleware/core.js index ee9d8ef..c836d4c 100644 --- a/src/middleware/core.js +++ b/src/middleware/core.js @@ -673,7 +673,7 @@ module.exports = (req, res, logFacilities, config, next) => { res.head = fs.existsSync("./.head") ? fs.readFileSync("./.head").toString() : (fs.existsSync("./head.html") ? fs.readFileSync("./head.html").toString() : ""); // header res.foot = fs.existsSync("./.foot") ? fs.readFileSync("./.foot").toString() : (fs.existsSync("./foot.html") ? fs.readFileSync("./foot.html").toString() : ""); // footer } catch (err) { - callServerError(500, err); + res.error(500, err); } // Authenticated user variable @@ -690,20 +690,20 @@ module.exports = (req, res, logFacilities, config, next) => { return; } else { // SVR.JS doesn't understand that request, so throw an 400 error - callServerError(400); + res.error(400); return; } } if (req.headers["expect"] && req.headers["expect"] != "100-continue") { // Expectations not met. - callServerError(417); + res.error(417); return; } - + if (req.method == "CONNECT") { // CONNECT requests should be handled in "connect" event. - callServerError(501); + res.error(501); logFacilities.errmessage( "CONNECT requests aren't supported. Your JS runtime probably doesn't support 'connect' handler for HTTP library.", );