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?
yes, try this JS code, to append a slash:
var targetUrl = "http://mocktarget.apigee.net/"; context.setVariable("target.copy.pathsuffix", "false"); context.setVariable("target.url", targetUrl);
It's a pain that Apigee is so rigid that it doesn't allow you to just use the domain.
But there's a workaround.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |