From fd851ba6cb39369f2cb1b5958a90cd023c05426a Mon Sep 17 00:00:00 2001 From: AsamK Date: Sat, 23 Sep 2023 11:52:37 +0200 Subject: [PATCH] Fix batch response in case of empty responses list This adapts the implementation to the JSON-RPC specification. --- src/main/java/org/asamk/signal/jsonrpc/JsonRpcReader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/asamk/signal/jsonrpc/JsonRpcReader.java b/src/main/java/org/asamk/signal/jsonrpc/JsonRpcReader.java index e49b6cd0..27da9b0b 100644 --- a/src/main/java/org/asamk/signal/jsonrpc/JsonRpcReader.java +++ b/src/main/java/org/asamk/signal/jsonrpc/JsonRpcReader.java @@ -95,7 +95,9 @@ public class JsonRpcReader { return handleRequest(requestHandler, request); }).filter(Objects::nonNull).toList(); - jsonRpcSender.sendBatchResponses(responseList); + if (responseList.size() > 0) { + jsonRpcSender.sendBatchResponses(responseList); + } } }