Support a relative url path to the service.

This commit is contained in:
Hiram Chirino
2012-03-09 15:06:38 -05:00
parent b659da04a8
commit 0061046d3b

View File

@@ -7,7 +7,7 @@ function SwaggerService(discoveryUrl, _apiKey, statusCallback) {
if (discoveryUrl.length == 0)
throw new Error("discoveryUrl must be passed while creating SwaggerService");
if (! (discoveryUrl.toLowerCase().indexOf("http:") == 0 || discoveryUrl.toLowerCase().indexOf("https:") == 0)) {
if ( discoveryUrl.indexOf("/")!=0 && ! (discoveryUrl.toLowerCase().indexOf("http:") == 0 || discoveryUrl.toLowerCase().indexOf("https:") == 0)) {
discoveryUrl = ("http://" + discoveryUrl);
}