Commit 085cc05c authored by Tony Tam's avatar Tony Tam
Browse files

fixed responseMessages issue per #267

parent 888db09f
...@@ -669,7 +669,7 @@ ...@@ -669,7 +669,7 @@
}; };
SwaggerOperation.prototype["do"] = function(args, opts, callback, error) { SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
var key, param, params, possibleParams, req, requestContentType, responseContentType, value; var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref;
if (args == null) { if (args == null) {
args = {}; args = {};
} }
...@@ -705,20 +705,30 @@ ...@@ -705,20 +705,30 @@
}; };
} }
params = {}; params = {};
params.headers = [];
if (args.headers != null) { if (args.headers != null) {
params.headers = args.headers; params.headers = args.headers;
delete args.headers; delete args.headers;
} }
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
if (param.paramType === "header") {
if (args[param.name]) {
params.headers[param.name] = args[param.name];
}
}
}
if (args.body != null) { if (args.body != null) {
params.body = args.body; params.body = args.body;
delete args.body; delete args.body;
} }
possibleParams = (function() { possibleParams = (function() {
var _i, _len, _ref, _results; var _j, _len1, _ref1, _results;
_ref = this.parameters; _ref1 = this.parameters;
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
param = _ref[_i]; param = _ref1[_j];
if (param.paramType === "form" || param.paramType.toLowerCase() === "file") { if (param.paramType === "form" || param.paramType.toLowerCase() === "file") {
_results.push(param); _results.push(param);
} }
...@@ -839,7 +849,7 @@ ...@@ -839,7 +849,7 @@
SwaggerRequest = (function() { SwaggerRequest = (function() {
function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) { function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) {
var body, e, fields, headers, key, myHeaders, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values, var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
_this = this; _this = this;
this.type = type; this.type = type;
this.url = url; this.url = url;
...@@ -962,6 +972,9 @@ ...@@ -962,6 +972,9 @@
} }
body = urlEncoded; body = urlEncoded;
} }
for (name in headers) {
myHeaders[name] = headers[name];
}
if (requestContentType) { if (requestContentType) {
myHeaders["Content-Type"] = requestContentType; myHeaders["Content-Type"] = requestContentType;
} }
......
...@@ -461,7 +461,7 @@ function program11(depth0,data) { ...@@ -461,7 +461,7 @@ function program11(depth0,data) {
stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data}); stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; } if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n "; buffer += "\n ";
stack1 = helpers['if'].call(depth0, depth0.errorResponses, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data}); stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; } if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n "; buffer += "\n ";
stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data}); stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
...@@ -1134,10 +1134,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ...@@ -1134,10 +1134,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1) buffer += escapeExpression(stack1)
+ "</td>\n<td>"; + "</td>\n<td>";
if (stack1 = helpers.reason) { stack1 = stack1.call(depth0, {hash:{},data:data}); } if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.reason; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if(stack1 || stack1 === 0) { buffer += stack1; } if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "</td>\n\n"; buffer += "</td>\n";
return buffer; return buffer;
}); });
})(); })();
......
This diff is collapsed.
...@@ -669,7 +669,7 @@ ...@@ -669,7 +669,7 @@
}; };
SwaggerOperation.prototype["do"] = function(args, opts, callback, error) { SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
var key, param, params, possibleParams, req, requestContentType, responseContentType, value; var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref;
if (args == null) { if (args == null) {
args = {}; args = {};
} }
...@@ -705,20 +705,30 @@ ...@@ -705,20 +705,30 @@
}; };
} }
params = {}; params = {};
params.headers = [];
if (args.headers != null) { if (args.headers != null) {
params.headers = args.headers; params.headers = args.headers;
delete args.headers; delete args.headers;
} }
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
if (param.paramType === "header") {
if (args[param.name]) {
params.headers[param.name] = args[param.name];
}
}
}
if (args.body != null) { if (args.body != null) {
params.body = args.body; params.body = args.body;
delete args.body; delete args.body;
} }
possibleParams = (function() { possibleParams = (function() {
var _i, _len, _ref, _results; var _j, _len1, _ref1, _results;
_ref = this.parameters; _ref1 = this.parameters;
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
param = _ref[_i]; param = _ref1[_j];
if (param.paramType === "form" || param.paramType.toLowerCase() === "file") { if (param.paramType === "form" || param.paramType.toLowerCase() === "file") {
_results.push(param); _results.push(param);
} }
...@@ -839,7 +849,7 @@ ...@@ -839,7 +849,7 @@
SwaggerRequest = (function() { SwaggerRequest = (function() {
function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) { function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) {
var body, e, fields, headers, key, myHeaders, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values, var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
_this = this; _this = this;
this.type = type; this.type = type;
this.url = url; this.url = url;
...@@ -962,6 +972,9 @@ ...@@ -962,6 +972,9 @@
} }
body = urlEncoded; body = urlEncoded;
} }
for (name in headers) {
myHeaders[name] = headers[name];
}
if (requestContentType) { if (requestContentType) {
myHeaders["Content-Type"] = requestContentType; myHeaders["Content-Type"] = requestContentType;
} }
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</tbody> </tbody>
</table> </table>
{{/if}} {{/if}}
{{#if errorResponses}} {{#if responseMessages}}
<div style='margin:0;padding:0;display:inline'></div> <div style='margin:0;padding:0;display:inline'></div>
<h4>Error Status Codes</h4> <h4>Error Status Codes</h4>
<table class='fullwidth'> <table class='fullwidth'>
......
<td width='15%' class='code'>{{code}}</td> <td width='15%' class='code'>{{code}}</td>
<td>{{{reason}}}</td> <td>{{{message}}}</td>
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