Fix: handle null id in json-rpc responses

This commit is contained in:
Liran Vaknin 2024-06-04 02:39:44 +03:00
parent 67a69a5878
commit add54c9eaa

View File

@ -31,6 +31,10 @@ export async function sendJsonRpcRequest(url, method, params, username, password
if (status === 200) {
const json = JSON.parse(data.toString());
if (json.id === null) {
json.id = 1;
}
// in order to get access to the underlying error object in the JSON response
// you must set `result` equal to undefined
if (json.error && json.result === null) {