我理解通常的HTTP请求生命周期,我想做的是:
向端点发出请求,当所有数据都已发送时,我想立即关闭连接,忽略任何可能的答案。
请注意,我不想忽略答案,我想从字面上不听一个,因为连接会被关闭=)
答案 0 :(得分:1)
只是不要连接客户端数据事件。
app.post('/something', function(req,res) {
client.post(...., function(res2){
//let the posted value and response finish
//won't do anything with it
res2.resume();
//if you want to return after post, but before response data is read.
//comment out the res.end below, and use this one.
// res.end("done");
});
//if you are just wanting to fire and forget the post request...
res.end("done");
});