I am using a pipeline to decrypt the post data, and every user have a key.
so i am doing it as injectable and trying to inject request
@Injectable()
export class DecryptDataPipe implements PipeTransform {
constructor(
private applicationUsersService: ApplicationUsersService,
private userKeysService: UserKeysService,
@Req() private request,
) {}
...
}
this code always return an error, how to fix it?
To inject the Request
object you need to use @Inject(REQUEST)
. @Req()
is a parameter decorator for controller methods, not for general use in constructors.