forked from loafle/openapi-generator-original
[JAVA] fix "text/plain" with charset specifications (#15399)
This commit is contained in:
parent
977de5b324
commit
e152799569
@ -855,7 +855,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
// add extension to indicate content type is `text/plain` and the response type is `String`
|
||||
if (op.produces != null) {
|
||||
for (Map<String, String> produce : op.produces) {
|
||||
if ("text/plain".equalsIgnoreCase(produce.get("mediaType"))
|
||||
if ("text/plain".equalsIgnoreCase(produce.get("mediaType").split(";")[0].trim())
|
||||
&& "String".equals(op.returnType)) {
|
||||
op.vendorExtensions.put("x-java-text-plain-string", true);
|
||||
continue;
|
||||
|
@ -255,7 +255,7 @@ public class {{classname}} {
|
||||
{{#vendorExtensions.x-java-text-plain-string}}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
|
@ -182,7 +182,7 @@ public class BodyApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -263,7 +263,7 @@ public class BodyApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -417,7 +417,7 @@ public class BodyApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -498,7 +498,7 @@ public class BodyApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
|
@ -124,7 +124,7 @@ public class FormApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
|
@ -124,7 +124,7 @@ public class HeaderApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
|
@ -122,7 +122,7 @@ public class PathApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
|
@ -127,7 +127,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -221,7 +221,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -319,7 +319,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -413,7 +413,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -505,7 +505,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -597,7 +597,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -687,7 +687,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
@ -782,7 +782,7 @@ public class QueryApi {
|
||||
}
|
||||
// for plain text response
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0).split(";")[0].trim())) {
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
|
Loading…
x
Reference in New Issue
Block a user