NestJS · Middle · Question 6 of 75
What does an interceptor's intercept(context, next) return?
intercept(context: ExecutionContext, next: CallHandler) {
const start = Date.now();
return next.handle().pipe(tap(() => console.log(Date.now() - start)));
}- ✓Correct answer: An Observable:
next.handle()calls the handler, and RxJS operators can transform or observe the result - 2A boolean that allows or blocks the request
- 3A promise of the request body
Explanation
If you don't call next.handle(), the handler never runs. That's how caching interceptors return stored responses.