Bird
0
0

Which parameter does the canActivate method receive to check the current request in NestJS?

easy📝 Conceptual Q2 of 15
NestJS - Guards
Which parameter does the canActivate method receive to check the current request in NestJS?
AResponseObject
BExecutionContext
CRequestObject
DHttpStatus
Step-by-Step Solution
Solution:
  1. Step 1: Identify the method parameter

    The canActivate method receives an ExecutionContext object.
  2. Step 2: Understand ExecutionContext role

    This object provides access to the current request and other context details.
  3. Final Answer:

    The parameter is ExecutionContext -> Option B
  4. Quick Check:

    canActivate parameter = ExecutionContext [OK]
Quick Trick: canActivate always gets ExecutionContext parameter [OK]
Common Mistakes:
  • Using RequestObject directly instead of ExecutionContext
  • Confusing ResponseObject with the parameter
  • Expecting HttpStatus as parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes