Skip to content

Commit

Permalink
fix(code-gen): don't throw a 404 on no match in the router
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dirkdev98 committed May 17, 2023
1 parent 74a23c8 commit 077da8a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions packages/code-gen/src/router/js-koa.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,7 @@ export function jsKoaBuildRouterFile(file, routesPerGroup, contextNamesMap) {

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

fileWrite(file, `if (!match) { throw AppError.notFound(); }\n`);

// const decodePathParam = (arg) => {
// try {
// return decodeURIComponent(arg);
// } catch (e) {
// throw AppError.validationError("router.param.invalidEncoding", {
// param: arg,
// });
// }
// };
fileWrite(file, `if (!match) { return next(); }\n`);

fileBlockStart(file, `if (match.params)`);
fileBlockStart(
Expand Down

0 comments on commit 077da8a

Please sign in to comment.