我正在从 ajax 到节点服务器进行后期调用。服务器发出呼叫并给出响应。但在 cmd 提示符下也会显示以下错误
express deprecated res.send(status, body): Use res.status(status).send(body) instead server.js:203:26
_http_server.js:248
throw new ERR_HTTP_INVALID_STATUS_CODE(originalStatusCode);
^RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: exporting started
at ServerResponse.writeHead (_http_server.js:248:11)
at ServerResponse._implicitHeader (_http_server.js:239:8)
at write_ (_http_outgoing.js:650:9)
at ServerResponse.end (_http_outgoing.js:761:5)
at ServerResponse.send (D:\Impex-Node server\node_modules\express\lib\response.js:221:10)
at ServerResponse.json (D:\Impex-Node server\node_modules\express\lib\response.js:267:15)
at ServerResponse.send (D:\Impex-Node server\node_modules\express\lib\response.js:158:21)
at Request._callback (D:\Impex-Node server\server\server.js:203:26)
at Request.self.callback (D:\Impex-Node server\node_modules\request\request.js:185:22)
at Request.emit (events.js:310:20) {
code: 'ERR_HTTP_INVALID_STATUS_CODE'
}
[nodemon] app crashed - waiting for file changes before starting...
这里有什么问题?有人可以帮我知道吗
以下是请求电话:-
request.post(url, {
body :req_body,
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${access_token}`
}
}, (error, res, body) => {
if (error) {
console.log('An error occured while loading the page', error)
return
}
let data = JSON.parse(body);
console.log("export data", data);
console.log("export call:", data)
response.send("exporting started", data)
}