Skip to content

Commit 63b09a3

Browse files
committed
fix(json-rpc): prevent undefined results for non-notifications
1 parent fa21043 commit 63b09a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/json-rpc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ export function defineJsonRpcHandler<RequestT extends EventHandlerRequest = Even
256256
}
257257

258258
// For notifications, the server MUST NOT reply (§4.1).
259-
return notification ? undefined : { jsonrpc: "2.0" as const, id: id!, result };
259+
return notification
260+
? undefined
261+
: { jsonrpc: "2.0" as const, id: id!, result: result ?? null };
260262
} catch (error_: any) {
261263
// For notifications, errors are silently discarded (§4.1).
262264
if (notification) {

0 commit comments

Comments
 (0)