Team
This was originally posted to postman support. They told me to post it in the community.
I am getting socket hang up error while executing the following using newman(4.4.0) after executing few iterations. First few iterations are running fine. After that getting this error. There are no coding issues. The test suite is working fine when executed locally (desktop enterprise version 7.26) for 1-2 iterations.
is there a way to make sendRequest call synchronously or equivalent one to make a synchronous call?
- Making a get request returns a response. The response returns items array. One of the attribute in the items array is url. items array’s length is around 100-300. For example items[0].url…items[99].url.
- Iterating over the response array till the length of the array
- The test (test tab) checks if the url(s) returned is valid or not by using the following code snippet
- It is executing fine when executed locally or using postman desktop OR from command line using newman when the array size is small say 10.
Error
**5093. Error socket hang up **
iteration: at request
12 inside “”
Code snippet
//for loop to go through each array item from the response
pm.sendRequest(url, function (err, res) {
if (res.code !==200)
{
console.log("This url is not reachable: " +url);
console.log("Error code = "+res.code);
}
else
{
success = true;
}
});
//end of for loop
I need to verify each url from the response. The tests are failing due to socket hang up error. is there a way to make sendRequest call synchronously?
Appreciate your suggestions/input.