CodeQL library for JavaScript/TypeScript
codeql/javascript-all 2.6.19-dev (changelog, source)
Search

Member predicate Routing::RouteSetup::Base::isMiddlewareSetup

Holds if this is a middleware setup, meaning dispatch will resume after the route handlers in this route setup have completed (usually meaning that they have returned a promise, which has resolved).

This should only be overridden when the route setup itself determines whether subsequent route handlers are invoked afterwards.

  • For Express-like libraries, the route handler determines whether to resume dispatch, based on whether the next callback is invoked. For such libraries, do not override isMiddlewareSetup.
  • For Fastify-like libraries, the route setup determines whether to resume dispatch. For example, .addHook() will resume dispatch whereas .get() will not. isMiddlewareSetup() should thus hold for .addHook() but not for .get() calls.
predicate isMiddlewareSetup()