Allow batch RPC calls

This commit is contained in:
bitspill 2018-10-16 14:27:23 -07:00 committed by GitHub
parent cc8b496a96
commit d10de7fa72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,8 +437,15 @@ HTTPBase.prototype.jsonRPC = function jsonRPC(rpc) {
if (req.pathname !== '/')
return;
if (typeof req.body.method !== 'string')
return;
if (req.body instanceof Array) {
for (const request of req.body) {
if (typeof request.method !== 'string')
return;
}
} else {
if (typeof req.body.method !== 'string')
return;
}
let json = await rpc.call(req.body, req.query);