Skip to content

Commit

Permalink
fix #251
Browse files Browse the repository at this point in the history
fix the issue 
#251
add params node into request when args is null or empty .
  • Loading branch information
anysoft authored Nov 15, 2019
1 parent 7c329be commit df5aa24
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ private ObjectNode internalCreateRequest(String methodName, Object arguments, St
addParameters(arguments, request);
addAdditionalHeaders(request);
notifyBeforeRequestListener(request);
addNoneArguments(request);
return request;
}

Expand Down Expand Up @@ -423,6 +424,13 @@ private boolean isCollectionArguments(Object arguments) {
return arguments != null && Collection.class.isInstance(arguments);
}

private void addNoneArguments(ObjectNode request){
if (!request.has(PARAMS)){
//for none params add an empty array
request.set(PARAMS,mapper.valueToTree(new String[0]));
}
}

private void addCollectionArguments(Object arguments, ObjectNode request) {
Collection<?> args = Collection.class.cast(arguments);
if (!args.isEmpty()) {
Expand Down

0 comments on commit df5aa24

Please sign in to comment.