您还应该收听“结束”事件
req.on('response', function (response) { var data = ""; response.on('data', function (chunk) { console.log(chunk); data += chunk; }); response.on('end', function(){ callback(data); })});
您还应该收听“结束”事件
req.on('response', function (response) { var data = ""; response.on('data', function (chunk) { console.log(chunk); data += chunk; }); response.on('end', function(){ callback(data); })});