Fix batch response in case of empty responses list

This adapts the implementation to the JSON-RPC specification.
This commit is contained in:
AsamK 2023-09-23 11:52:37 +02:00
parent b2a32666e9
commit fd851ba6cb

View file

@ -95,9 +95,11 @@ public class JsonRpcReader {
return handleRequest(requestHandler, request); return handleRequest(requestHandler, request);
}).filter(Objects::nonNull).toList(); }).filter(Objects::nonNull).toList();
if (responseList.size() > 0) {
jsonRpcSender.sendBatchResponses(responseList); jsonRpcSender.sendBatchResponses(responseList);
} }
} }
}
private JsonRpcResponse handleRequest(final RequestHandler requestHandler, final JsonRpcRequest request) { private JsonRpcResponse handleRequest(final RequestHandler requestHandler, final JsonRpcRequest request) {
try { try {