I need help writing a common function to use across a collection of requests which will help with building a framework.
I have tried using the below format
Without eval:
Define an object containing your function(s) in the collection's pre-request scripts without using let, var, etc. This attaches it to Postman's global sandbox object.
utils = {
myFunc: function() {
return 'hello';
}
};
Then within your request's pre-request or test script section just call the function:
console.log(utils.myFunc());