I want to call a request method that gets the body of itself as an array that is also one item of another array. so I should iterate over this parent array and pass its items to request method for a new request to server.
I have used bodies.forEach
but this make the calls async
and I should also do something after every response and need sync
calls. What is the best way to do this?
bodies = [ [['name', 'Saeid'], ['age','23']],
[['name', 'Saeid'], ['age', 23 ], ['city', 'Tehran']]
]
bodies.forEach(function(body){
request(body, function(res){
//do something with this response and if meet oure desired condition continue...
)};
});