*add safety check to ensure the rpc response complies with the structure

This commit is contained in:
Derrick Hammer 2022-08-31 00:14:05 -04:00
parent afc49802b0
commit 231c4a36b4
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 0 deletions

View File

@ -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;