Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
f3e17971
Commit
f3e17971
authored
Feb 04, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed jsonrpc response 0 not handled properly
parent
a0cfa3ca
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
4 deletions
+19
-4
ethereum.js
dist/ethereum.js
+1
-1
ethereum.js.map
dist/ethereum.js.map
+1
-1
ethereum.min.js
dist/ethereum.min.js
+1
-1
jsonrpc.js
lib/jsonrpc.js
+1
-1
jsonrpc.isValidResponse.js
test/jsonrpc.isValidResponse.js
+15
-0
No files found.
dist/ethereum.js
View file @
f3e17971
...
...
@@ -979,7 +979,7 @@ var isValidResponse = function (response) {
!
response
.
error
&&
response
.
jsonrpc
===
'2.0'
&&
typeof
response
.
id
===
'number'
&&
(
!!
response
.
result
||
typeof
response
.
result
===
'boolean'
);
response
.
result
!==
undefined
;
// only undefined is not valid json object
};
/// Should be called to create batch payload object
...
...
dist/ethereum.js.map
View file @
f3e17971
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
f3e17971
This diff is collapsed.
Click to expand it.
lib/jsonrpc.js
View file @
f3e17971
...
...
@@ -45,7 +45,7 @@ var isValidResponse = function (response) {
!
response
.
error
&&
response
.
jsonrpc
===
'2.0'
&&
typeof
response
.
id
===
'number'
&&
(
!!
response
.
result
||
typeof
response
.
result
===
'boolean'
);
response
.
result
!==
undefined
;
// only undefined is not valid json object
};
/// Should be called to create batch payload object
...
...
test/jsonrpc.isValidResponse.js
View file @
f3e17971
...
...
@@ -124,5 +124,20 @@ describe('jsonrpc', function () {
assert
.
equal
(
valid
,
true
);
});
it
(
'should validate jsonrpc response with result field === 0'
,
function
()
{
// given
var
response
=
{
jsonrpc
:
'2.0'
,
id
:
1
,
result
:
0
};
// when
var
valid
=
jsonrpc
.
isValidResponse
(
response
);
// then
assert
.
equal
(
valid
,
true
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment