请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

设置seCookie时报错Cannot set headers after they are sent to the client

(node:21048) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at handleUserRouter (C:\Users\Year Li\Desktop\blog\blog-1\src\router\user.js:16:9)
at getPostData.then.postData (C:\Users\Year Li\Desktop\blog\blog-1\app.js:86:22)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:21048) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

正在回答 回答被采纳积分+3

1回答

双越 2019-04-13 15:33:22

常见错误。你在 setCookie 之前,已经进行了 res 的返回操作,即 res.end ,自己去查一查代码。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信