Skip to content

Commit 745178c

Browse files
authored
Merge pull request #37 from jtanx/master
Fix multicall
2 parents 082ceb1 + c593a36 commit 745178c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/Aria2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class Aria2 extends JSONRPCClient {
3535
}
3636

3737
async multicall(calls) {
38-
const multi = calls.map(([method, ...params]) => {
39-
return [{ methodName: prefix(method), params: this.addSecret(params) }];
40-
});
41-
38+
const multi = [
39+
calls.map(([method, ...params]) => {
40+
return { methodName: prefix(method), params: this.addSecret(params) };
41+
})
42+
];
4243
return super.call("system.multicall", multi);
4344
}
4445

test/Aria2.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ test("#multicall", t => {
2525
t.deepEqual(m, {
2626
method: "system.multicall",
2727
params: [
28-
[{ methodName: "aria2.a", params: ["token:foobar", "1", "2"] }],
29-
[{ methodName: "aria2.b", params: ["token:foobar", "1", "2"] }]
28+
[
29+
{ methodName: "aria2.a", params: ["token:foobar", "1", "2"] },
30+
{ methodName: "aria2.b", params: ["token:foobar", "1", "2"] }
31+
]
3032
],
3133
id: 0,
3234
"json-rpc": "2.0"

0 commit comments

Comments
 (0)