fix java apache client optional body, add tests (#14227)

This commit is contained in:
William Cheng
2022-12-08 20:58:47 +08:00
committed by GitHub
parent 1fad61e2f8
commit 11d31117a8
4 changed files with 33 additions and 4 deletions

View File

@@ -932,6 +932,9 @@ public class ApiClient extends JavaTimeFormatter {
} else {
throw new ApiException("method " + method + " does not support a request body");
}
} else {
// for empty body
builder.setEntity(serialize(null, null, contentTypeObj));
}
try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) {