Settingup pm.sendRequest() as env variable

I am setting up few requests which need to be executed before certain requests of collection at pre-request script via pm.sendRequest() method.

My need is to keep entire pm.sendRequest() as environment variable and will call it in required pre-request tab by getting its variable name as pm.environment.get(“variablename”)… Also,i want to update json key value after getting it from environment.

Any help on this…

Have a look at the following article on Stack Overflow.

javascript - How to Write Global Functions in Postman - Stack Overflow

There are examples of using Environment variables with EVAL that should give you a starting point.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.