读取超时。向node.js API发送POST请求时出错)
我有一个node.js API,如下所示,我从python发送一个POST请求,如下所示,面临的问题是如果我删除了headers={"Content-Type": "application/json"}
开机自检,如果我没有收到Read timed out. error
,有人可以提供有关如何解决此超时错误的指南吗?node.js端点
app.post("/api/bats_push",(req, res) => {
//console.log("Calling bats_push...")
const d = {
method: req.method,
headers: req.headers,
query: req.query,
body: ''
}
req.on('data', (c) => {
//console.log(c)
d.body = d.body + c
});
req.on('end', () => {
DATA.push(d);
res.end('Saved BATS job details');
//res.status(200).json({
//message: "Saved BATS job details",
//posts: req.body
//});
});
});
Python POST
try:
json"},timeout=10.0)
r = requests.post(webhook_url,data=json_data.encode("utf8"),verify=False,headers={"Content-Type": "application/json"})
print "posted"
print(r.status_code, r.reason)
print r.url
print r.text
except Exception as e:
print (e)
错误:-
InsecureRequestWarning)
HTTPSConnectionPool(host='company', port=443): Read timed out. (read timeout=10.0)
我有一个node.js API,如下所示,我从python发送一个POST请求,如下所示,面临的问题是,如果我删除标头= {“ Content-Type”:“ application / json”} thorugh,if not i ...回答如下:根据请求,为什么不使用此: