The code (with dynamically adding and removing REST hosts) :
var host = new RESTHost("IP echo");
host.url = "http://ipecho.net/";
host = RESTHostManager.addHost(host);
try {
var response = host.createRequest("GET", "plain").execute();
RESTHostManager.removeHost(host.id);
return response.contentAsString;
} catch (e) {
RESTHostManager.removeHost(host.id);
throw e;
}
No comments:
Post a Comment