在我的拦截器中,我需要获取请求体内容,在请求被传递到控制器之前:
import { Injectable, NestInterceptor, ExecutionContext, HttpException, HttpStatus } from '@nestjs/common';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable()
export class ExcludeNullInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, call$: Observable<any>): Observable<any> {
// How can I get the request body here?
// Need to be BEFORE the Controller exec
}
}