updated swagger-js
This commit is contained in:
@@ -216,7 +216,7 @@ SwaggerClient.prototype.build = function() {
|
||||
url: this.url,
|
||||
method: "get",
|
||||
headers: {
|
||||
accept: "application/json"
|
||||
accept: "application/json, */*"
|
||||
},
|
||||
on: {
|
||||
error: function(response) {
|
||||
@@ -260,6 +260,11 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
this.produces = response.produces;
|
||||
this.authSchemes = response.authorizations;
|
||||
|
||||
if(typeof this.host === 'undefined' || this.host === '') {
|
||||
var location = this.parseUri(this.url);
|
||||
this.host = location.host;
|
||||
}
|
||||
|
||||
this.definitions = response.definitions;
|
||||
var key;
|
||||
for(key in this.definitions) {
|
||||
@@ -330,6 +335,16 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
return this;
|
||||
}
|
||||
|
||||
SwaggerClient.prototype.parseUri = function(uri) {
|
||||
var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
|
||||
var parts = urlParseRE.exec(uri);
|
||||
return {
|
||||
scheme: parts[4].replace(':',''),
|
||||
host: parts[11],
|
||||
path: parts[15]
|
||||
};
|
||||
}
|
||||
|
||||
SwaggerClient.prototype.help = function() {
|
||||
var i;
|
||||
log('operations for the "' + this.label + '" tag');
|
||||
|
||||
Reference in New Issue
Block a user