Manipulating variables in insomnia

295 views Asked by At

I was using Postman and I have this on it:

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("nivel", jsonData.authenticationModel.nivel_ensino);

if(postman.getEnvironmentVariable("nivel") == "POSGRADUACAO"){
    postman.setEnvironmentVariable("nivel-modificado", "pos-graduacao");
} else {
     postman.setEnvironmentVariable("nivel-modificado", postman.getEnvironmentVariable("nivel"));
}

Is there anyway I could do the same in Insomnia? I know how to set env variables and all, its the if /else part that I want help with.

Tried creating a new variable to receive the one already there and them change it somehow. But don't know how it works in Insomnia.

What I want is that when nivel receives "POSGRADUACAO" it will be changed to "pos-graduacao" and a new variable will receive the new value.

0

There are 0 answers