Skip to content
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

JSON-RPC 2.0 non-compliant behavior #13

Open
ssimeonov opened this issue May 17, 2014 · 1 comment
Open

JSON-RPC 2.0 non-compliant behavior #13

ssimeonov opened this issue May 17, 2014 · 1 comment

Comments

@ssimeonov
Copy link

The spec mandates that responses must include either result or error but not both. The code in https://github.com/movitto/rjr/blob/master/lib/rjr/messages/response.rb#L62 does not reflect this. As a result, for example, RJR talking to a JSON-RPC 1.x server will interpret an error response as a success with nil result.

@movitto
Copy link
Owner

movitto commented May 17, 2014

Hey thanks for reaching out. Am a bit confused by the target specification which you are refering to with this issue, 2.0 or 1.x.

In the 2.0 case if result is set and there is no error, response.success will be true and response.error false as intended. If the error is set and result is missing from the response, response.success will be false and response.error true.

This is also the case w/ all the 1.1 versions, the only one which seems to differ is 1.0 where if an error occurs 'result' will be returned as null and if no error occurs 'error' will be returned as null. In this case yes RJR will not behave as expected since the response will have the null 'result' key on errors.

2.0: http://www.jsonrpc.org/specification
1.0: http://json-rpc.org/wiki/specification

RJR currently advertises only JSON-RPC 2.0 compatibilty right now, but I'd be down to include 1.x support. Just not sure what other differences are entailed between the versions. Something that you might know / know where to find offhand?

Thanks again for the issue.
-Mo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants