Compare commits

...
9 Commits
7 changed files with 2513 additions and 2717 deletions
+1234 -1348
View File
File diff suppressed because it is too large Load Diff
+22 -11
View File
@@ -1281,13 +1281,24 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
SwaggerUi.prototype.buildUrl = function(base, url) {
var parts;
var endOfPath, parts;
log("base is " + base);
parts = base.split("/");
base = parts[0] + "//" + parts[2];
if (url.indexOf("/") === 0) {
parts = base.split("/");
base = parts[0] + "//" + parts[2];
return base + url;
} else {
endOfPath = base.length;
if (base.indexOf("?") > -1) {
endOfPath = Math.min(endOfPath, base.indexOf("?"));
}
if (base.indexOf("#") > -1) {
endOfPath = Math.min(endOfPath, base.indexOf("#"));
}
base = base.substring(0, endOfPath);
if (base.indexOf("/", base.length - 1) !== -1) {
return base + url;
}
return base + "/" + url;
}
};
@@ -1682,16 +1693,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
OperationView.prototype.wrap = function(data) {
var o,
_this = this;
var headerArray, headers, i, o, _i, _ref5, _ref6;
headers = {};
headerArray = data.getAllResponseHeaders().split(":");
for (i = _i = 0, _ref5 = headerArray.length / 2, _ref6 = 2.; _ref6 > 0 ? _i <= _ref5 : _i >= _ref5; i = _i += _ref6) {
headers[headerArray[i]] = headerArray[i + 1];
}
o = {};
o.content = {};
o.content.data = data.responseText;
o.getHeaders = function() {
return {
"Content-Type": data.headers("Content-Type")
};
};
o.headers = headers;
o.request = {};
o.request.url = this.invocationUrl;
o.status = data.status;
@@ -1818,7 +1829,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
var code, content, contentType, headers, pre, response_body;
content = response.data;
headers = response.headers;
contentType = headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
contentType = headers && headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
if (!content) {
code = $('<code />').text("no content");
pre = $('<pre class="json" />').append(code);
+1 -1
View File
File diff suppressed because one or more lines are too long
+1234 -1348
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "2.0.4",
"version": "2.0.9",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -19,7 +19,7 @@
"readmeFilename": "README.md",
"dependencies": {
"coffee-script": "~1.5.0",
"swagger-client": "2.0.9",
"swagger-client": "2.0.14",
"handlebars": "~1.0.10",
"less": "~1.4.2"
}
+11 -4
View File
@@ -69,13 +69,20 @@ class SwaggerUi extends Backbone.Router
buildUrl: (base, url) ->
log "base is " + base
parts = base.split("/")
base = parts[0] + "//" + parts[2]
if url.indexOf("/") is 0
parts = base.split("/")
base = parts[0] + "//" + parts[2]
base + url
else
base + "/" + url
endOfPath = base.length
if base.indexOf("?") > -1
endOfPath = Math.min(endOfPath, base.indexOf("?"))
if base.indexOf("#") > -1
endOfPath = Math.min(endOfPath, base.indexOf("#"))
base = base.substring(0, endOfPath);
if base.indexOf( "/", base.length - 1 ) isnt -1
return base + url
return base + "/" + url
# Shows message on topbar of the ui
showMessage: (data = '') ->
@@ -169,12 +169,18 @@ class OperationView extends Backbone.View
false
# end of file-upload nastiness
# wraps a jquery response as a shred response
# wraps a jquery response as a shred response
wrap: (data) ->
headers = {}
headerArray = data.getAllResponseHeaders().split(":")
for i in [0..headerArray.length/2] by (2)
headers[headerArray[i]] = headerArray[i+1]
o = {}
o.content = {}
o.content.data = data.responseText
o.getHeaders = () => {"Content-Type": data.headers("Content-Type")}
o.headers = headers
o.request = {}
o.request.url = @invocationUrl
o.status = data.status
@@ -276,7 +282,7 @@ class OperationView extends Backbone.View
headers = response.headers
# if server is nice, and sends content-type back, we can use it
contentType = if headers["Content-Type"] then headers["Content-Type"].split(";")[0].trim() else null
contentType = if headers && headers["Content-Type"] then headers["Content-Type"].split(";")[0].trim() else null
if !content
code = $('<code />').text("no content")