fall through to 404 if no handler exists for method

This commit is contained in:
Rich Harris
2018-01-13 23:29:41 -05:00
parent e3c047831a
commit 727a76ebb5

View File

@@ -174,18 +174,19 @@ function get_route_handler(fn) {
res.end(page);
}
return;
}
else {
const method = req.method.toLowerCase();
// 'delete' cannot be exported from a module because it is a keyword,
// so check for 'del' instead
const method_export = method === 'delete' ? 'del' : method;
const handler = mod[method_export];
if (handler) handler(req, res, next);
const method = req.method.toLowerCase();
// 'delete' cannot be exported from a module because it is a keyword,
// so check for 'del' instead
const method_export = method === 'delete' ? 'del' : method;
const handler = mod[method_export];
if (handler) {
handler(req, res, next);
return;
}
return;
}
}