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

Commit 727a76e

Browse files
committed
fall through to 404 if no handler exists for method
1 parent e3c0478 commit 727a76e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/index.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,19 @@ function get_route_handler(fn) {
174174

175175
res.end(page);
176176
}
177-
}
178177

179-
else {
180-
const method = req.method.toLowerCase();
181-
// 'delete' cannot be exported from a module because it is a keyword,
182-
// so check for 'del' instead
183-
const method_export = method === 'delete' ? 'del' : method;
184-
const handler = mod[method_export];
185-
if (handler) handler(req, res, next);
178+
return;
186179
}
187180

188-
return;
181+
const method = req.method.toLowerCase();
182+
// 'delete' cannot be exported from a module because it is a keyword,
183+
// so check for 'del' instead
184+
const method_export = method === 'delete' ? 'del' : method;
185+
const handler = mod[method_export];
186+
if (handler) {
187+
handler(req, res, next);
188+
return;
189+
}
189190
}
190191
}
191192

0 commit comments

Comments
 (0)