mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-16 21:04:34 +00:00
Handle DELETE requests with del export
This commit is contained in:
@@ -177,7 +177,11 @@ function get_route_handler(fn) {
|
||||
}
|
||||
|
||||
else {
|
||||
const handler = mod[req.method.toLowerCase()];
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user