http.get リクエストでループしようとしていますが、関数が開始されない理由がわかりません。私のコードは:
while(List.length>0) {
if(counter < Limit) { // Limit is the amount of requests I want to
counter++;
inProcess++;
var scanitem = List.pop();
var body = "";
var url = 'https://www.mywebsite.com/'+scanitem;
var options = {
path: url,
method: 'GET'
};
console.log(url); // This part is happenning
var _request = https.get(options, function (res) {
console.log('get web site');// this part is NOT showup.
res.on('data', function (chunk) {
console.log(chunk); // this part is NOT showup.
body += chunk.toString();
});
res.on("end", function() {
console.log(body);// this part is NOT showup.
});
res.on("error", function(error) {
console.log('error')// this part is NOT showup.
});
});
_request.end();
}
else {
console.log('list BREAK');} // This part is happenning after the limit crossed