forked from loafle/openapi-generator-original
fix issue content-type default charset (#13009)
This commit is contained in:
parent
e811d6bbe2
commit
6226dc2848
@ -707,18 +707,14 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
/**
|
/**
|
||||||
* Parse content type object from header value
|
* Parse content type object from header value
|
||||||
*/
|
*/
|
||||||
private ContentType getContentType(String headerValue) throws ApiException {
|
private ContentType getContentType(String headerValue) {
|
||||||
try {
|
return ContentType.getByMimeType(headerValue);
|
||||||
return ContentType.parse(headerValue);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new ApiException("Could not parse content type " + headerValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get content type of a response or null if one was not provided
|
* Get content type of a response or null if one was not provided
|
||||||
*/
|
*/
|
||||||
private String getResponseMimeType(HttpResponse response) throws ApiException {
|
private String getResponseMimeType(HttpResponse response) {
|
||||||
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
||||||
if (contentTypeHeader != null) {
|
if (contentTypeHeader != null) {
|
||||||
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
||||||
|
@ -662,18 +662,14 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
/**
|
/**
|
||||||
* Parse content type object from header value
|
* Parse content type object from header value
|
||||||
*/
|
*/
|
||||||
private ContentType getContentType(String headerValue) throws ApiException {
|
private ContentType getContentType(String headerValue) {
|
||||||
try {
|
return ContentType.getByMimeType(headerValue);
|
||||||
return ContentType.parse(headerValue);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new ApiException("Could not parse content type " + headerValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get content type of a response or null if one was not provided
|
* Get content type of a response or null if one was not provided
|
||||||
*/
|
*/
|
||||||
private String getResponseMimeType(HttpResponse response) throws ApiException {
|
private String getResponseMimeType(HttpResponse response) {
|
||||||
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
||||||
if (contentTypeHeader != null) {
|
if (contentTypeHeader != null) {
|
||||||
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user