我必须按顺序执行一些http请求,所以我使用的是瀑布
Http 请求大约需要 2 秒才能响应。
返回的响应在 console.log(string) 中有效,但在 response.end() 中未定义;
async.waterfall([
function(callback_wf_adnet){
///Getting URLS for http requests.
},
function(adnetlist, callback_wf_adnet){
///Switchman does http request
adData=switchman(element, ip, agent, req);
if (adData!='') {
callback_wf_adnet(null, adData);
return false;
}
return true;
});
},
function(adData, callback_wf_adnet){
console.log("ADDATA="+adData); /// Output works here
if(adData!='')
{
response.send(adData); /// It doesn't work here
}
callback_wf_adnet(null, "just closing somethings");
}
], function (err, result) {
});