Skip to content

Commit

Permalink
fix(platform-express) make check for already registered parsers work …
Browse files Browse the repository at this point in the history
…with Express 5

Express 5 made the router public API again and renamed the field from app._router to app.router.
This broke the detection mechanism whether a middleware named "jsonParser" or "urlencodedParser"
is already re or not, because app._router no longer exists.
  • Loading branch information
luddwichr committed Feb 5, 2025
1 parent 29aeadb commit 9ae019f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/platform-express/adapters/express-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@ export class ExpressAdapter extends AbstractHttpAdapter<
const app = this.getInstance();
return (
!!app._router &&
!!app._router.stack &&
isFunction(app._router.stack.filter) &&
app._router.stack.some(
!!app.router.stack &&
isFunction(app.router.stack.filter) &&
app.router.stack.some(
(layer: any) => layer && layer.handle && layer.handle.name === name,
)
);
Expand Down

0 comments on commit 9ae019f

Please sign in to comment.