updated swagger-js, added #507 to dist

This commit is contained in:
Tony Tam
2014-08-02 09:31:17 -07:00
parent e04b756521
commit 0a52e344e7
4 changed files with 29 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
// swagger.js
// version 2.0.34
// version 2.0.35
var __bind = function(fn, me){
return function(){
@@ -1203,9 +1203,9 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
// if any form params, content type must be set
if(definedFormParams.length > 0) {
if(definedFileParams.length > 0)
accepts = "multipart/form-data";
consumes = "multipart/form-data";
else
accepts = "application/x-www-form-urlencoded";
consumes = "application/x-www-form-urlencoded";
}
else if (this.type == "DELETE")
body = "{}";
@@ -1213,10 +1213,10 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
accepts = null;
}
if (contentType && this.operation.consumes) {
if (this.operation.consumes.indexOf(contentType) === -1) {
log("server doesn't consume " + contentType + ", try " + JSON.stringify(this.operation.consumes));
contentType = this.operation.consumes[0];
if (consumes && this.operation.consumes) {
if (this.operation.consumes.indexOf(consumes) === -1) {
log("server doesn't consume " + consumes + ", try " + JSON.stringify(this.operation.consumes));
consumes = this.operation.consumes[0];
}
}
@@ -1231,13 +1231,13 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
accepts = this.operation.produces[0];
}
}
if (contentType && contentType.indexOf("application/x-www-form-urlencoded") === 0) {
if (consumes && consumes.indexOf("application/x-www-form-urlencoded") === 0) {
var fields = {};
var possibleParams = {};
var values = {};
var key;
for(key in formParams){
var param = formParams[key];
for(key in definedFormParams){
var param = definedFormParams[key];
values[param.name] = param;
}
@@ -1253,8 +1253,8 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
}
body = encoded;
}
if ((contentType && body !== "") || (contentType === "application/x-www-form-urlencoded"))
headers["Content-Type"] = contentType;
if ((consumes && body !== "") || (consumes === "application/x-www-form-urlencoded"))
headers["Content-Type"] = consumes;
if (accepts)
headers["Accept"] = accepts;
@@ -1603,3 +1603,4 @@ e.SwaggerModel = SwaggerModel;
e.SwaggerModelProperty = SwaggerModelProperty;
e.SwaggerResource = SwaggerResource;
e.SwaggerApi = SwaggerApi;