I'm quite new in NestJS and I'm using it to handle a rest API server. I'm trying to send some HTTP-only cookie in the response and I'm following the official documentation and it suggests to use the cookie
method in the Response
object but it looks like that method is not defined. This is my code:
@Get('login')
verifyLoginEmailCode(
@Headers() { email, password }: LoginInputDto,
@Res({ passthrough: true }) res: Response,
) {
// as per official documentation res.cookie should be a function but it's not defined
console.log(Object.keys(res)); // in the keys "cookie" is missing
return this.authAdminService.login(email, password);
}
Is there any mistake?
CodePudding user response:
You should import them correctly. you should import Response from express and Req
from @nestjs/common
.