From 86f2ea5e3e14a9738efd1e38a624e5810091b855 Mon Sep 17 00:00:00 2001 From: Lars Wander Date: Fri, 4 Aug 2017 12:47:52 -0400 Subject: [PATCH] [Java] okhttp-gson content-type fix for */* (#6232) --- .../resources/Java/libraries/okhttp-gson/ApiClient.mustache | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 94f89a56dd8..c61eadb1b1d 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -608,11 +608,11 @@ public class ApiClient { * * @param contentTypes The Content-Type array to select from * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. + * or matches "any", JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; } for (String contentType : contentTypes) { if (isJsonMime(contentType)) {