nodejs res.download()下载时点击暂停时出现的错误

FishKing 发布于 2015/01/22 11:39
阅读 1K+
收藏 0

在做nodejs下载时使用res.download()点击暂停时出现错误,以下是提示的错误

http.js:690
    throw new Error('Can\'t set headers after they are sent.');
          ^
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)
    at ServerResponse.header (E:\NodejsProjects\filedownload\node_modules\express\lib\response.js:695:10)
    at ServerResponse.send (E:\NodejsProjects\filedownload\node_modules\express\lib\response.js:146:12)
    at fn (E:\NodejsProjects\filedownload\node_modules\express\lib\response.js:929:10)
    at handleTemplate (E:\NodejsProjects\filedownload\node_modules\ejs\lib\ejs.js:209:18)
    at E:\NodejsProjects\filedownload\node_modules\ejs\lib\ejs.js:226:7
    at fs.js:272:14
    at Object.oncomplete (fs.js:108:15)

请各位大神指点!!

加载中
0
zabcd117
zabcd117

这提示,你先设置header再发送请求啊。

返回顶部
顶部