-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve response handling #50
Improve response handling #50
Conversation
fcd537e
to
7341c87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of small nits. Other than that, LGTM.
test/index_test.js
Outdated
|
||
const [newAddressError, addressValidation] = await new Client(config.bitcoind).command(batch); | ||
|
||
addressValidation.should.have.properties('address', 'isvalid', 'ismine', 'scriptPubKey'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort list.
src/parser.js
Outdated
throw new RpcError(response.statusCode, response.statusMessage); | ||
} | ||
|
||
function getRpcBody(body, { headers = false, response } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the method description as well.
7341c87
to
0f2ca1a
Compare
* Better error handling for both RPC and REST calls. * Handle `text/html` and `text/plain` differences from both request types correctly. * Proxy response errors as error messages for easier debugging. * Add a test for batched requests where one of the request fails. * Handle errors in binary-encoded requests. * Parse REST responses with JSONBigInt to avoid losing precision. This means that some of the response values will now be strings (e.g. the network difficulty on `getDifficulty()`).
0f2ca1a
to
093d562
Compare
text/html
andtext/plain
differences from both request types correctly.getDifficulty()
).