返回req存在循环引用
报错 ERROR [ExceptionsHandler] Converting circular structure to JSON
–> starting at object with constructor ‘Socket’
| property ‘parser’ -> object with constructor ‘HTTPParser’
— property ‘socket’ closes the circle
解决办法:
- 返回更具体的数据(req.params,req.session,req.query…)
- 在服务端console.log(req)
- 安装模块(
npm i circular-json
),使用circularJson.stringify来包裹一下req(res.send(circularJson.stringify(req))
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)