diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/EncodingUtils.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/EncodingUtils.mustache index 6bf2a0e4bfbb..705eb6aa9d39 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/EncodingUtils.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/EncodingUtils.mustache @@ -77,7 +77,7 @@ public final class EncodingUtils { return null; } try { - return URLEncoder.encode(parameter.toString(), "UTF-8"); + return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/EncodingUtils.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/EncodingUtils.java index 1b061a1972f1..c5a76a97857a 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/EncodingUtils.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/EncodingUtils.java @@ -77,7 +77,7 @@ public static String encode(Object parameter) { return null; } try { - return URLEncoder.encode(parameter.toString(), "UTF-8"); + return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e); diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java index 1b061a1972f1..c5a76a97857a 100644 --- a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java @@ -77,7 +77,7 @@ public static String encode(Object parameter) { return null; } try { - return URLEncoder.encode(parameter.toString(), "UTF-8"); + return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { // Should never happen, UTF-8 is always supported throw new RuntimeException(e);