File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -1732,16 +1732,13 @@ public class ApiClient {
17321732 RequestBody requestBody;
17331733 if (obj instanceof String) {
17341734 requestBody = RequestBody.create((String) obj, MediaType.parse(" text/plain" ));
1735+ } else if (obj == null){
1736+ requestBody = RequestBody.create(obj, MediaType.parse(" application/json" ));
1737+ } else if (obj.getClass().getEnumConstants() != null) {
1738+ requestBody = RequestBody.create(obj.toString(), MediaType.parse(" text/plain" ));
17351739 } else {
1736- String content;
1737- if (obj != null) {
1738- content = JSON.serialize(obj);
1739- } else {
1740- content = null;
1741- }
1742- requestBody = RequestBody.create(content, MediaType.parse("application/json"));
1740+ requestBody = RequestBody.create(JSON.serialize(obj), MediaType.parse(" application/json" ));
17431741 }
1744-
17451742 Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"");
17461743 mpBuilder.addPart(partHeaders, requestBody);
17471744 }
You can’t perform that action at this time.
0 commit comments