I’m running a postman collection that runs a reset command against multiple IPs. The reset command closes the connection (as designed) because it is causing a reboot of the device.
I’d like my collection to continue to loop through the other IPs in the list when this happens but it is dying after the first one. How do I handle the socket reset and keep going?
Here’s my Tests tab:
var scrIPs = pm.environment.get("scrIPs");
if(scrIPs && scrIPs.length > 0){
postman.setNextRequest("http://{{scrIP}}:986");
} else {
postman.setNextRequest(null);
}
My Pre-Request Script:
var scrIPs = pm.environment.get("scrIPs");
if(!scrIPs) {
scrIPs = ["IP ADDRESS #1", "IP ADDRESS #2", "etc",];
}
var currentSCRip = scrIPs.shift();
pm.environment.set("scrIP",currentSCRip);
pm.environment.set("scrIPs",scrIPs);
And my Body:
<TRANSACTION>
<TRANSACTIONTYPE>RESETREQUESTED</TRANSACTIONTYPE>
</TRANSACTION>
My Post command is http://{{scrIP}}:986
The first IP will be called and then the script dies because of the Socket reset - I want to ignore that and continue with all the other IPs in my list until the entire list is done.
Being new to Postman/postscript I figure I have to catch/throw - but can someone assist me with the above script?