Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
fall through to 404 if no handler exists for method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 14, 2018
1 parent e3c0478 commit 727a76e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,19 @@ function get_route_handler(fn) {

res.end(page);
}
}

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);
return;
}

return;
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;
}
}
}

Expand Down

0 comments on commit 727a76e

Please sign in to comment.