I'm trying to access the response of my POST request in Postman via Pre-request Script.
Script given below :
var mobiles = postman.environment.get("mobiles");
if (!mobiles)
{
mobiles =["8824444866","8058506668"];
}
var currentMobile = mobiles.shift();
postman.environement.set("mobile","currentMobile");
postman.environement.set("mobiles",mobiles);
When I click on Send button, in the postman it shows an error, which is given below:
Their was an error in evaluation the Pre-request Script: Cannot read property 'get' of undefined.
Please suggest some solution
environment
is undefined here, what does aconsole.log(postman)
shows to you? – Calvin Nunes