mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 05:31:03 +00:00
Update jsonrpc2.js
This commit is contained in:
parent
e332682fd2
commit
6537f9a635
|
@ -41,7 +41,8 @@ function JsonRpcObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.call = function(method, params, id) {
|
this.call = function(method, params, id) {
|
||||||
var data = HTTP.create("MSXML")
|
var result;
|
||||||
|
var response = HTTP.create("MSXML")
|
||||||
.setContentType("application/json")
|
.setContentType("application/json")
|
||||||
.setDataType("json")
|
.setDataType("json")
|
||||||
.setRequestBody(encode(method, params, id))
|
.setRequestBody(encode(method, params, id))
|
||||||
|
@ -50,7 +51,16 @@ function JsonRpcObject() {
|
||||||
.responseBody
|
.responseBody
|
||||||
;
|
;
|
||||||
|
|
||||||
return data;
|
if ("error" in response) {
|
||||||
|
console.error(response.error.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("result" in response) {
|
||||||
|
result = response.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user