Please post trace details & error details. When you say an error, without details it’s difficult to understand. Please provide details to better understand same.
@Vinay Soni , I don’t see any error in trace. Did you use the proxy i have attached ? Can you post your javascript code & post man call too.. It should work out of the box.
when you add the javascript policy in the target request instead of proxy request.
and modify your javascript like this :
var getPayload = context.getVariable("request.content");
var targetUrl = "http://google.com?visitorInfo="+getPayload;
context.setVariable("target.url",targetUrl);
it will fail and that’s the same issue i am geting in my proxy.
here’s the response:
{
"fault": {
"faultstring": "Execution of JavaScript-1 failed on line 6 with error: Unresolved variable : \n \"id\"",
"detail": {
"errorcode": "steps.javascript.ScriptExecutionFailedLineNumber"
}
}
}
i have to use encodeURIComponent(uri) method before appending it to target url.
working javascript:
var getPayload = context.getVariable("request.content");
var targetUrl = "http://google.com?visitorInfo="+encodeURIComponent(getPayload);
context.setVariable("target.url",targetUrl);
Thanks for all the help @Anil Sagar. i really appreciate it