在使用Response装饰器时,必须通过调用响应对象(例如,res.json(…)或 res.send(…))发出某种响应,否则HTTP服务器将挂起。

示例:

// 设置cookie
    @Get('set-cookie')
    setCookie(@Response() res) {
        res.cookie("name", 'mfg');
        // res.send({
        //     status: 1
        // })
        //or
        res.json({
            status: 1
        })
    }

 

相关文章:

  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2018-03-26
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案