Skip to content

Commit 077da8a

Browse files
committed
fix(code-gen): don't throw a 404 on no match in the router
This is not up to the generated router to decide. It should just let the underlying app handle unknown requests. Which our `getApp` from `@compas/store` does.
1 parent 74a23c8 commit 077da8a

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

packages/code-gen/src/router/js-koa.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,7 @@ export function jsKoaBuildRouterFile(file, routesPerGroup, contextNamesMap) {
411411

412412
fileWrite(file, `const match = routeMatcher(ctx.method, ctx.path);\n`);
413413

414-
fileWrite(file, `if (!match) { throw AppError.notFound(); }\n`);
415-
416-
// const decodePathParam = (arg) => {
417-
// try {
418-
// return decodeURIComponent(arg);
419-
// } catch (e) {
420-
// throw AppError.validationError("router.param.invalidEncoding", {
421-
// param: arg,
422-
// });
423-
// }
424-
// };
414+
fileWrite(file, `if (!match) { return next(); }\n`);
425415

426416
fileBlockStart(file, `if (match.params)`);
427417
fileBlockStart(

0 commit comments

Comments
 (0)