Created
February 10, 2022 02:14
-
-
Save miparnisari/85db72271bae3ef3145e3dcf4a1559fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendingRequest(msg, initiator, helper) { | |
var urlParams = msg.getUrlParams(); | |
console.log("Url Params before update: " + urlParams); | |
var updatedUrlParams = modifyParams(urlParams); | |
console.log("Url Params after update: " + urlParams); | |
msg.setGetParams(updatedUrlParams); | |
} | |
function modifyParams(params) { | |
let iterator = params.iterator(); | |
while(iterator.hasNext()) { | |
let param = iterator.next(); | |
if (param.getName().equals("store_id")) { | |
let envStoreId = org.zaproxy.zap.extension.script.ScriptVars.getGlobalVar("store_id"); | |
console.log("Env store id: " + envStoreId); | |
if (envStoreId != null) { | |
param.setValue(envStoreId); | |
break; | |
} | |
} | |
if (param.getName().equals("customer_id")) { | |
let envCustomerId = org.zaproxy.zap.extension.script.ScriptVars.getGlobalVar("customer_id"); | |
console.log("Env customer id: " + envCustomerId); | |
if (envCustomerId != null) { | |
param.setValue(envCustomerId); | |
break; | |
} | |
} | |
} | |
return params; | |
} | |
function responseReceived(msg, initiator, helper) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment