Skip to content

Commit d870f2d

Browse files
committed
throw a TypeError on non-function handler closes #31
1 parent a99ba9d commit d870f2d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function create(method) {
2424
const re = pathToRegexp(path, keys, opts);
2525
debug('%s %s -> %s', method || 'ALL', path, re);
2626

27+
if (typeof fn !== 'function') {
28+
throw new TypeError('Route handler must be a function');
29+
}
30+
2731
const createRoute = function(routeFunc) {
2832
return function (ctx, next){
2933
// method

0 commit comments

Comments
 (0)