Skip to content

dist\swagger-ui.js code has a problem for <if> condition in SwaggerClient.prototype.initialize #2290

@hzwei206

Description

@hzwei206

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions