I am trying to dynamically change the target url in javascript. It returns below error if url has only domain or no url path.
{
"fault": {
"faultstring": "Path cannot be empty",
"detail": {
"errorcode": "protocol.http.EmptyPath"
}
}
}
Javascript code:
var targetUrl = "http://mocktarget.apigee.net";
context.setVariable("target.copy.pathsuffix", "false");
context.setVariable("target.url", targetUrl);
It works fine if the url is http://mocktarget.apigee.net/json. Added /json in the end. How to change the url dynamically if url doesn’t have url path or resource?