Skip to content

Commit 4ba4b90

Browse files
authored
[java-jersey2] Fix empty body when form parameters supplied (#5169)
1 parent a6b9e3e commit 4ba4b90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/jersey2/ApiClient.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ public class ApiClient {
573573
entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE);
574574
} else {
575575
// We let jersey handle the serialization
576-
entity = Entity.entity(obj, contentType);
576+
entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType);
577577
}
578578
return entity;
579579
}
@@ -732,7 +732,7 @@ public class ApiClient {
732732
}
733733
}
734734

735-
Entity<?> entity = (body == null) ? Entity.json("") : serialize(body, formParams, contentType);
735+
Entity<?> entity = serialize(body, formParams, contentType);
736736

737737
Response response = null;
738738

0 commit comments

Comments
 (0)