[Java][Native] Fix an issue leading to an altered String parameter when consuming formatted strings like XML (#11640)

* Fix the generated request builder when using a string body parameter

* Update the samples according to the fix for #11638
This commit is contained in:
Paul-Etienne François
2022-02-18 04:50:15 +01:00
committed by GitHub
parent d6a97b0c39
commit d45cb6511f
3 changed files with 7 additions and 12 deletions

View File

@@ -519,12 +519,7 @@ public class FakeApi {
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "*/*");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofString(body));
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}

View File

@@ -445,12 +445,7 @@ public class FakeApi {
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "*/*");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofString(body));
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}