You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/06/28 06:58:37 UTC
[GitHub] liubao68 commented on a change in pull request #781: [SCB-701] RequestBody(required = false) should invoke method when bod…
liubao68 commented on a change in pull request #781: [SCB-701] RequestBody(required = false) should invoke method when bod…
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/781#discussion_r198725292
##########
File path: common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/param/BodyProcessorCreator.java
##########
@@ -77,7 +83,10 @@ public void setValue(RestClientRequest clientRequest, Object arg) throws Excepti
try (BufferOutputStream output = new BufferOutputStream()) {
clientRequest.putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
RestObjectMapper.INSTANCE.writeValue(output, arg);
- clientRequest.write(output.getBuffer());
+ if (arg != null) {
Review comment:
Can you add a test case to show return body is required while users pass a null value? Json will encoding null to "null", so I think here may got some problem.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services