src/middlewares/http.js
Function handler
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
: async (req, res, config) => {
let middlewareChainingTransferPreviousResult;
for (const fn of prepared) {
if (fn.simple || !fn.async) {
fn(req, res, config, middlewareChainingTransferPreviousResult);
Avoid deeply nested control flow statements. Open
Open
if (config._errorHandler) {
return config._errorHandler(middleware.error, req, res);
}
Avoid deeply nested control flow statements. Open
Open
if (config._errorHandler) {
return config._errorHandler(error, req, res);
}
Avoid too many return
statements within this function. Open
Open
return;
Avoid too many return
statements within this function. Open
Open
return res.end(
`{"middleware_type":"${fn.type}",error":"${middleware.error.message}"}`
);
Avoid too many return
statements within this function. Open
Open
return res;
Avoid too many return
statements within this function. Open
Open
return config._errorHandler(middleware.error, req, res);
Avoid too many return
statements within this function. Open
Open
return res;
Avoid too many return
statements within this function. Open
Open
return route(
req,
res,
config,
middlewareChainingTransferPreviousResult