File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
modules/swagger-codegen/src/main/resources/Java Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -385,8 +385,15 @@ public class ApiClient {
385
385
386
386
if (contentType.startsWith(" application/json" )) {
387
387
return json.deserialize(body, returnType);
388
+ } else if (returnType.getType().equals(String.class)) {
389
+ // Expecting string, return the raw response body.
390
+ return (T) body;
388
391
} else {
389
- throw new ApiException(500, " can not deserialize Content-Type: " + contentType);
392
+ throw new ApiException(
393
+ 500,
394
+ " Content type \" " + contentType + " \" is not supported for type: "
395
+ + returnType.getType()
396
+ );
390
397
}
391
398
}
392
399
Original file line number Diff line number Diff line change @@ -389,8 +389,15 @@ public class ApiClient {
389
389
390
390
if (contentType.startsWith(" application/json" )) {
391
391
return json.deserialize(body, returnType);
392
+ } else if (returnType.getType().equals(String.class)) {
393
+ // Expecting string, return the raw response body.
394
+ return (T) body;
392
395
} else {
393
- throw new ApiException(500, " can not deserialize Content-Type: " + contentType);
396
+ throw new ApiException(
397
+ 500,
398
+ " Content type \" " + contentType + " \" is not supported for type: "
399
+ + returnType.getType()
400
+ );
394
401
}
395
402
}
396
403
@@ -429,7 +436,7 @@ public class ApiClient {
429
436
}
430
437
}
431
438
432
- Invocation.Builder invocationBuilder = target.request(contentType ).accept(accept);
439
+ Invocation.Builder invocationBuilder = target.request().accept(accept);
433
440
434
441
for (String key : headerParams.keySet()) {
435
442
String value = headerParams.get(key);
Original file line number Diff line number Diff line change @@ -536,9 +536,12 @@ public class ApiClient {
536
536
}
537
537
if (contentType.startsWith("application/json")) {
538
538
return json.deserialize(respBody, returnType);
539
+ } else if (returnType.equals(String.class)) {
540
+ // Expecting string, return the raw response body.
541
+ return (T) respBody;
539
542
} else {
540
543
throw new ApiException(
541
- " Content type \" " + contentType + " \" is not supported" ,
544
+ " Content type \" " + contentType + " \" is not supported for type: " + returnType ,
542
545
response.code(),
543
546
response.headers().toMultimap(),
544
547
respBody);
You can’t perform that action at this time.
0 commit comments