mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 21:22:46 +00:00
[Java] Fix content for enum in MultiPart (#21428)
* [Java] Fix content for enum in addPartToMultiPartBuilder ([#19973](https://github.com/OpenAPITools/openapi-generator/issues/19973)) * [Java] Fix content for enum with restclient (#19973) * [Java] Fix content for enum with restclient (#19973) * [Java] Fix content for enum with restclient (#19973) * update samples --------- Co-authored-by: Michael Bornholdt Nielsen <michaelbornholdtnielsen@gmail.com> Co-authored-by: Michael Bornholdt Nielsen <jarryDk@users.noreply.github.com>
This commit is contained in:
@@ -637,6 +637,18 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
addCookiesToRequest(cookieParams, requestBuilder);
|
||||
addCookiesToRequest(defaultCookies, requestBuilder);
|
||||
|
||||
if (MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType)) {
|
||||
formParams.forEach(
|
||||
(k, v) -> {
|
||||
if (v instanceof java.util.ArrayList) {
|
||||
Object o = v.get(0);
|
||||
if (o != null && o.getClass().getEnumConstants() != null) {
|
||||
v.set(0, o.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var selectedBody = selectBody(body, formParams, contentType);
|
||||
if (selectedBody != null) {
|
||||
requestBuilder.body(selectedBody);
|
||||
|
||||
Reference in New Issue
Block a user