Bird
0
0

What will happen if a functional middleware does not call next() in NestJS?

medium📝 Conceptual Q5 of 15
NestJS - Middleware
What will happen if a functional middleware does not call next() in NestJS?
AThe request will hang and not proceed to the next middleware or handler
BThe request will automatically proceed to the next middleware
CNestJS throws a compile-time error
DThe middleware will be skipped silently
Step-by-Step Solution
Solution:
  1. Step 1: Understand next() role in middleware

    Calling next() passes control to the next middleware or route handler.
  2. Step 2: Consequence of missing next()

    If next() is not called, the request stays stuck in the current middleware, causing a hang.
  3. Final Answer:

    The request will hang and not proceed to the next middleware or handler -> Option A
  4. Quick Check:

    Missing next() causes request hang [OK]
Quick Trick: Always call next() to continue request flow [OK]
Common Mistakes:
  • Assuming NestJS auto-calls next()
  • Expecting compile-time errors for missing next()
  • Thinking middleware is skipped without next()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes