I am currently generating a few requests using the npm package request
like this:
for (var i = 0; i < array.length; i++) {
var options = {
url: '...',
headers: {
'...'
}
};
function callback(error, response, body) {
};
request(options, callback);
}
function toBeCalledWhenAllRequestsHaveFinished() {
}
I just don't know how to call toBeCalledWhenAllRequestsHaveFinished()
only once all requests have finished.
What should be done ?