Hi everyone
I want to run the same request several times
In pre-request script I have
var photo1 = pm.globals.get("uploaded_photo_id");
var photo2 = pm.globals.get("uploaded_photo_id1");
var photo3 = pm.globals.get("uploaded_photo_id2");
var photoArray = pm.environment.get("photoArray");
if(!photoArray){
photoArray = ["photo1", "photo2", "photo3"];
}
var currentPhotoArray = photoArray.shift();
pm.environment.set("currentphotos",currentPhotoArray );
pm.environment.set("photoArray", photoArray);
In Body I have
{
"photo_id":{{currentphotos}}
}
And in test I have
var photoArray = pm.environment.get("photoArray");
if(photoArray && photoArray.length > 0){
postman.setNextRequest(pm.environment.get("url") + '/contests/' + pm.globals.get("photo_id") + '/submissions/add?key=' + pm.globals.get("user_key"));
} else{
postman.setNextRequest(null);
}
The problem is that I can’t use properly “uploaded_photo_id”-s which are declared earlier as global variables