File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1732,13 +1732,16 @@ 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" ));
17391735 } else {
1740- requestBody = RequestBody.create(JSON.serialize(obj), MediaType.parse(" application/json" ));
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"));
17411743 }
1744+
17421745 Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"");
17431746 mpBuilder.addPart(partHeaders, requestBody);
17441747 }
You can’t perform that action at this time.
0 commit comments