swagger-ui version: I download the zip code, don't know the version
code file: swagger-ui-master.zip\swagger-ui-master\dist\swagger-ui.js
when I deployed the swagger-ui dist with tomcat, the chrome hint:
XMLHttpRequest cannot load http://localhost:8082http//petstore.swagger.io/v2/swagger.json
so I debug the swagger-ui.js, found that:
////////////////////////////////////////////////////////////////////////
the error code:
///////////////////////////////////////////////////////////////////////
SwaggerClient.prototype.initialize = function (url, options) {
.........................
if(this.url && (this.url.indexOf('http:') === -1 || this.url.indexOf('https:') === -1)) {
// no protocol, so we can only use window if it exists
if(typeof(window) !== 'undefined' && window && window.location) {
this.url = window.location.origin + this.url;
}
}
options = options || {};
.............................
}
////////////////////////////////////////////////////////////////////////
the first if condition is error! when the value of "this.url" has "http://", it still into the if code.
swagger-ui-master.zip\swagger-ui-master\dist\swagger-ui.min.js has same problem.