fix for #770
This commit is contained in:
15
dist/lib/swagger-client.js
vendored
15
dist/lib/swagger-client.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
// swagger-client.js
|
// swagger-client.js
|
||||||
// version 2.1.0-alpha.3
|
// version 2.1.0-alpha.4
|
||||||
/**
|
/**
|
||||||
* Array Model
|
* Array Model
|
||||||
**/
|
**/
|
||||||
@@ -936,7 +936,7 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if there's a body, need to set the accepts header via requestContentType
|
// if there's a body, need to set the accepts header via requestContentType
|
||||||
if (body && (this.type === 'post' || this.type === 'put' || this.type === 'patch' || this.type === 'delete')) {
|
if (body && (this.method === 'post' || this.method === 'put' || this.method === 'patch' || this.method === 'delete')) {
|
||||||
if (opts.requestContentType)
|
if (opts.requestContentType)
|
||||||
consumes = opts.requestContentType;
|
consumes = opts.requestContentType;
|
||||||
} else {
|
} else {
|
||||||
@@ -1379,8 +1379,15 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
|||||||
|
|
||||||
if(contentType != null) {
|
if(contentType != null) {
|
||||||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
||||||
if(response.responseText && response.responseText !== "")
|
if(response.responseText && response.responseText !== "") {
|
||||||
out.obj = JSON.parse(response.responseText);
|
try {
|
||||||
|
out.obj = JSON.parse(response.content.data);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
// do not set out.obj
|
||||||
|
log ("unable to parse JSON content");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
out.obj = {}
|
out.obj = {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// swagger-client.js
|
// swagger-client.js
|
||||||
// version 2.1.0-alpha.3
|
// version 2.1.0-alpha.4
|
||||||
/**
|
/**
|
||||||
* Array Model
|
* Array Model
|
||||||
**/
|
**/
|
||||||
@@ -936,7 +936,7 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if there's a body, need to set the accepts header via requestContentType
|
// if there's a body, need to set the accepts header via requestContentType
|
||||||
if (body && (this.type === 'post' || this.type === 'put' || this.type === 'patch' || this.type === 'delete')) {
|
if (body && (this.method === 'post' || this.method === 'put' || this.method === 'patch' || this.method === 'delete')) {
|
||||||
if (opts.requestContentType)
|
if (opts.requestContentType)
|
||||||
consumes = opts.requestContentType;
|
consumes = opts.requestContentType;
|
||||||
} else {
|
} else {
|
||||||
@@ -1379,8 +1379,15 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
|||||||
|
|
||||||
if(contentType != null) {
|
if(contentType != null) {
|
||||||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
||||||
if(response.responseText && response.responseText !== "")
|
if(response.responseText && response.responseText !== "") {
|
||||||
out.obj = JSON.parse(response.responseText);
|
try {
|
||||||
|
out.obj = JSON.parse(response.content.data);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
// do not set out.obj
|
||||||
|
log ("unable to parse JSON content");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
out.obj = {}
|
out.obj = {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user