*add safety check to ensure the rpc response complies with the structure
This commit is contained in:
parent
afc49802b0
commit
231c4a36b4
|
@ -126,6 +126,10 @@ export class RPCServer {
|
||||||
|
|
||||||
if (isStream) {
|
if (isStream) {
|
||||||
result = await streamHandler(isStream);
|
result = await streamHandler(isStream);
|
||||||
|
} else {
|
||||||
|
if (result && !result.error && !("data" in result)) {
|
||||||
|
result = { data: result };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = result as RPCResponse;
|
result = result as RPCResponse;
|
||||||
|
|
Loading…
Reference in New Issue