Skip to content

json-rpc 1.0 requires 'result' and 'error' attributes in the HTTP responses #113

@inaltoasinistra

Description

@inaltoasinistra

hello folks,

Description

I'm implementing a json-rpc v1.0 server but I found a problem with the protocol specification.

As reported in the v1.0 protocol specification, both 'result' and 'error' attributes must be defined in responses, and them must be null if not used.

result - The Object that was returned by the invoked method. This must be null in case there was an error invoking the method.
error - An Error object if there was an error invoking the method. It must be null if there was no error.

Steps to Reproduce

  1. I create a tests json-rpc server with this code
  2. I simulate a json-rpc client with curl

curl --header "Content-Type: application/json" --header "Accept: application/json" -d '{"method":"sum_all", "id": "curltest", "params": [0, 1.1, 345, 1e-06]}' http://localhost:4000/

  1. the result of the call does not have the attribute 'error'

{"id": "curltest", "result": 346.100001}

Expected behavior: I would expect the output

{"id": "curltest", "result": 346.100001, "error": null}

Actual behavior: as reported before:

{"id": "curltest", "result": 346.100001}

Reproduces how often: every time

Versions

  • Python 3.5.3
  • Debian GNU/Linux 9
  • json-rpc==1.13.0

Additional Information

None

Thank you!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions