更新时间:2022-03-25 21:39:14
你也应该监听 'end' 事件
you should also listen for the 'end' event
req.on('response', function (response) {
var data = "";
response.on('data', function (chunk) {
console.log(chunk);
data += chunk;
});
response.on('end', function(){
callback(data);
})
});