mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-18 05:25:08 +00:00
fall through to 404 if no handler exists for method
This commit is contained in:
19
lib/index.js
19
lib/index.js
@@ -174,18 +174,19 @@ function get_route_handler(fn) {
|
|||||||
|
|
||||||
res.end(page);
|
res.end(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
const method = req.method.toLowerCase();
|
||||||
const method = req.method.toLowerCase();
|
// 'delete' cannot be exported from a module because it is a keyword,
|
||||||
// 'delete' cannot be exported from a module because it is a keyword,
|
// so check for 'del' instead
|
||||||
// so check for 'del' instead
|
const method_export = method === 'delete' ? 'del' : method;
|
||||||
const method_export = method === 'delete' ? 'del' : method;
|
const handler = mod[method_export];
|
||||||
const handler = mod[method_export];
|
if (handler) {
|
||||||
if (handler) handler(req, res, next);
|
handler(req, res, next);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user