mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
Skip null form values for Java native request builder (#15036)
This commit is contained in:
@@ -157,9 +157,15 @@ public class FormApi {
|
||||
localVarRequestBuilder.header("Accept", "text/plain");
|
||||
|
||||
List<NameValuePair> formValues = new ArrayList<>();
|
||||
formValues.add(new BasicNameValuePair("integer_form", integerForm.toString()));
|
||||
formValues.add(new BasicNameValuePair("boolean_form", booleanForm.toString()));
|
||||
formValues.add(new BasicNameValuePair("string_form", stringForm.toString()));
|
||||
if (integerForm != null) {
|
||||
formValues.add(new BasicNameValuePair("integer_form", integerForm.toString()));
|
||||
}
|
||||
if (booleanForm != null) {
|
||||
formValues.add(new BasicNameValuePair("boolean_form", booleanForm.toString()));
|
||||
}
|
||||
if (stringForm != null) {
|
||||
formValues.add(new BasicNameValuePair("string_form", stringForm.toString()));
|
||||
}
|
||||
HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8);
|
||||
ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user