mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +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) {
|
||||
var data = HTTP.create("MSXML")
|
||||
var result;
|
||||
var response = HTTP.create("MSXML")
|
||||
.setContentType("application/json")
|
||||
.setDataType("json")
|
||||
.setRequestBody(encode(method, params, id))
|
||||
|
@ -50,7 +51,16 @@ function JsonRpcObject() {
|
|||
.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