Complete the code to import the correct NestJS module for interceptors.
import { [1] } from '@nestjs/common';
The @Injectable decorator is needed to mark the interceptor class as injectable by NestJS.
Complete the code to implement the NestJS interceptor interface.
export class TimeoutInterceptor implements [1]<any> {
The NestInterceptor interface is implemented to create an interceptor in NestJS.
Fix the error in the method signature to correctly implement the intercept method.
intercept(context: ExecutionContext, next: [1]): Observable<any> {The intercept method receives a CallHandler as the second argument to handle the request flow.
Fill in the blank to apply a timeout of 5000 milliseconds to the observable.
return next.handle().pipe(timeout([1]));
The timeout operator takes the number of milliseconds before timing out. 5000 means 5 seconds.
Fill all three blanks to import the timeout operator, catchError operator, and throwError function from RxJS.
import { [1], [2] } from 'rxjs/operators'; import { [3] } from 'rxjs';
These three imports are needed to apply timeout, handle errors, and throw errors in rxjs streams.