⚡ Improving performance
This commit is contained in:
@@ -5,16 +5,16 @@ export default function getEnvironmentVariablesFromScript(script) {
|
||||
// for security and control purposes, this is the only way a pre-request script should modify variables.
|
||||
let pw = {
|
||||
environment: {
|
||||
set: (key, value) => _variables[key] = value,
|
||||
set: (key, value) => (_variables[key] = value)
|
||||
},
|
||||
env: {
|
||||
set: (key, value) => _variables[key] = value,
|
||||
},
|
||||
set: (key, value) => (_variables[key] = value)
|
||||
}
|
||||
// globals that the script is allowed to have access to.
|
||||
};
|
||||
|
||||
// run pre-request script within this function so that it has access to the pw object.
|
||||
(new Function('pw', script))(pw);
|
||||
new Function("pw", script)(pw);
|
||||
|
||||
return _variables;
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ export default function parseTemplateString(string, variables) {
|
||||
return string;
|
||||
}
|
||||
const searchTerm = /<<([^>]*)>>/g; // "<<myVariable>>"
|
||||
return string.replace(searchTerm, (match, p1) => variables[p1] || '');
|
||||
return string.replace(searchTerm, (match, p1) => variables[p1] || "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user