Bird
0
0

In NestJS, what is the primary role of a TimeoutInterceptor when handling requests?

easy📝 Conceptual Q1 of 15
NestJS - Interceptors

In NestJS, what is the primary role of a TimeoutInterceptor when handling requests?

ATo modify the response body before sending
BTo cache responses for faster retrieval
CTo log request details for debugging
DTo cancel requests that exceed a specified time limit
Step-by-Step Solution
Solution:
  1. Step 1: Understand Interceptor Purpose

    Interceptors in NestJS can transform or handle requests and responses.
  2. Step 2: Role of TimeoutInterceptor

    The TimeoutInterceptor specifically enforces a maximum time limit on request processing.
  3. Final Answer:

    To cancel requests that exceed a specified time limit -> Option D
  4. Quick Check:

    TimeoutInterceptor enforces time limits [OK]
Quick Trick: TimeoutInterceptor cancels slow requests [OK]
Common Mistakes:
  • Confusing timeout with caching
  • Assuming it modifies response content
  • Thinking it logs requests

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes