Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eval( ): Executing a JavaScript function #3347

Closed
sburtonctr opened this issue Aug 4, 2017 · 2 comments
Closed

eval( ): Executing a JavaScript function #3347

sburtonctr opened this issue Aug 4, 2017 · 2 comments

Comments

@sburtonctr
Copy link

Postman for Windows
Version 5.1.3
win32 10.0.14393 / x64

This issue starting happening after 4.10.7. I thought I would try to upgrade to see if it was fixed, but it appears to be broken or you have changed do not allow this any more.

Issue Report:

I load several custom JavaScript into a memory varaible before my test run. This is one of my scripts that is loaded in the Tests tab.

postman.setGlobalVariable("module:prefixedScopeVars", "clearPrefixFromScope=function(a,b,c){_.each(_.filter(_.keys(a),function(a){return a.startsWith(b)}),function(a){c(a)})},clearPrefixFromEnv=function(a){clearPrefixFromScope(environment,a,postman.clearEnvironmentVariable)},clearPrefixFromGlobal=function(a){clearPrefixFromScope(globals,a,postman.clearGlobalVariable)},anyPrefixedInScope=function(a,b){return _.some(_.keys(a),function(a){return a.startsWith(b)})},anyPrefixedInEnv=function(a){return anyPrefixedInScope(environment,a)},anyPrefixedInGlobal=function(a){return anyPrefixedInScope(globals,a)},function coalesce(){var len = arguments.length; for (var i=0; i<len; i++) {if (arguments[i] !== null && arguments[i] !== undefined) {return arguments[i];}}return null;}")

After all my scripts are loaded including this script, I execute a function to clear all my variables as such:

eval(postman.getGlobalVariable("module:prefixedScopeVars"));
clearPrefixFromGlobal("gws_");
clearPrefixFromEnv("ws_");

This generates an error in all versions above 4.10.7: Cannot convert undefined or null to object.

These two functions just remove all global and environmental variables that start with: "gws_" & "ws_".

I see that you remove the download links for 4.10.7, so I do not have a way to get back to a working version. Do you not support executing JavaScript functions from the Test tab anymore?

@sburtonctr
Copy link
Author

#2973 (comment)

Let me try your suggestion first. Sorry, I didn't see you resposne

@sburtonctr
Copy link
Author

That worked, Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant