diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache index 90f4cbcb33b..571a3e4e63f 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/ApiClient.mustache @@ -444,7 +444,7 @@ public class ApiClient { updateParamsForAuth(authNames, queryParams, headerParams); - if (accepts != null) { + if (accepts != null && accepts.length > 0) { headerParams.add(HttpHeaders.ACCEPT, selectHeaderAccept(accepts)); } @@ -579,7 +579,7 @@ public class ApiClient { return; } else { try { - resultContent = Json.mapper.readValue(httpResponse.bodyAsString(), returnType); + resultContent = this.objectMapper.readValue(httpResponse.bodyAsString(), returnType); result = Future.succeededFuture(resultContent); } catch (Exception e) { result = ApiException.fail(new DecodeException("Failed to decode:" + e.getMessage(), e)); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java index 4555d9a142f..84bad01a4ed 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java @@ -440,7 +440,7 @@ public class ApiClient { updateParamsForAuth(authNames, queryParams, headerParams); - if (accepts != null) { + if (accepts != null && accepts.length > 0) { headerParams.add(HttpHeaders.ACCEPT, selectHeaderAccept(accepts)); } @@ -575,7 +575,7 @@ public class ApiClient { return; } else { try { - resultContent = Json.mapper.readValue(httpResponse.bodyAsString(), returnType); + resultContent = this.objectMapper.readValue(httpResponse.bodyAsString(), returnType); result = Future.succeededFuture(resultContent); } catch (Exception e) { result = ApiException.fail(new DecodeException("Failed to decode:" + e.getMessage(), e));