I just implemented the code below by using "steed" library to do multiple call in order to get information for each item of the "mydevIds" array. But the execution of the request return just information of the first item. Did I miss something?
var mydevIds = [10,25,12,15,20];
function myRequest(id,cb){
var opt = {
host: 'my_hostname', //here only the domain name
port: 443
, path: 'rest_url(id)', //the rest of the url parameters if needed
method: 'GET', //do GET
auth: 'login:mdp'
};
var req = https.request(opt, function (res) {
var myData = '';
res.on('data', function (d) {
myData += d;
});
res.on('end', function () {
s = JSON.parse(myData);
console.log("s:",s);
});
});
req.end();
}
steed.mapSeries(mydevIds,function(id,cb){
myRequest(id,cb)
},function(err, results){
if(err){throw err}
console.log("results:",results)
})
via Blackhat
No comments:
Post a Comment