Other posts have dealt with this question, but I continue to be unable to apply this myself.
I have a Postman pre-script test.
I am trying to call an encryption function defined in http://some-server:port/lib/forge/forge.min.js
The code calls the code like this:
let pubKey = forge.pki.publicKeyFromPem(atob(publicKey));
...
let .... = forge.util.encodeUtf8(data));
let ... = forge.util.encode64(text);
...
I tried the eval
trick, putting the whole code into a variable.
var code = pm.collectionVariables.get('forge.min.js');
eval(code);
The resulting error was:
ReferenceError: forge is not defined
The code variable has the whole block of minified Javascript.