Commit b8943665 authored by Tony Tam's avatar Tony Tam
Browse files

updated client to 2.0.13

parent 0c0ffc56
......@@ -1693,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;
......@@ -1829,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);
......
This diff is collapsed.
This diff is collapsed.
......@@ -19,7 +19,7 @@
"readmeFilename": "README.md",
"dependencies": {
"coffee-script": "~1.5.0",
"swagger-client": "2.0.12",
"swagger-client": "2.0.13",
"handlebars": "~1.0.10",
"less": "~1.4.2"
}
......
......@@ -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")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment