forked from loafle/openapi-generator-original
resolve java okhttp issue due to merge conflicts
This commit is contained in:
parent
ef40bdb7b0
commit
f1e237f76f
@ -73,6 +73,12 @@ public class ApiClient {
|
||||
*/
|
||||
public ApiClient() {
|
||||
httpClient = new OkHttpClient();
|
||||
|
||||
{{#useGzipFeature}}
|
||||
// Enable gzip request compression
|
||||
httpClient.interceptors().add(new GzipRequestInterceptor());
|
||||
{{/useGzipFeature}}
|
||||
|
||||
verifyingSsl = true;
|
||||
json = new JSON();
|
||||
|
||||
@ -835,6 +841,13 @@ public class ApiClient {
|
||||
if (returnType == null || response.code() == 204) {
|
||||
// returning null if the returnType is not defined,
|
||||
// or the status code is 204 (No Content)
|
||||
if (response.body() != null) {
|
||||
try {
|
||||
response.body().close();
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return deserialize(response, returnType);
|
||||
|
@ -132,7 +132,8 @@ public class JSON {
|
||||
*/
|
||||
public static class DateTimeTypeAdapter extends TypeAdapter<DateTime> {
|
||||
|
||||
private DateTimeFormatter formatter;
|
||||
private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser();
|
||||
private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime();
|
||||
|
||||
public DateTimeTypeAdapter() {
|
||||
this(ISODateTimeFormat.dateTime().withOffsetParsed());
|
||||
@ -151,7 +152,7 @@ public class JSON {
|
||||
if (date == null) {
|
||||
out.nullValue();
|
||||
} else {
|
||||
out.value(formatter.print(date));
|
||||
out.value(printFormatter.print(date));
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +164,7 @@ public class JSON {
|
||||
return null;
|
||||
default:
|
||||
String date = in.nextString();
|
||||
return formatter.parseDateTime(date);
|
||||
return parseFormatter.parseDateTime(date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ public class ApiClient {
|
||||
*/
|
||||
public ApiClient() {
|
||||
httpClient = new OkHttpClient();
|
||||
|
||||
|
||||
verifyingSsl = true;
|
||||
json = new JSON();
|
||||
|
||||
@ -820,6 +822,13 @@ public class ApiClient {
|
||||
if (returnType == null || response.code() == 204) {
|
||||
// returning null if the returnType is not defined,
|
||||
// or the status code is 204 (No Content)
|
||||
if (response.body() != null) {
|
||||
try {
|
||||
response.body().close();
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return deserialize(response, returnType);
|
||||
|
Loading…
x
Reference in New Issue
Block a user