pavlov99 / json-rpc

🔁 JSON-RPC 1/2 transport implementation. Supports python 2/3 and pypy.
http://json-rpc.readthedocs.org
MIT License
464 stars 101 forks source link

Add JSON RPC response parsing #99

Open kacper-ka opened 6 years ago

kacper-ka commented 6 years ago

Requirements

Description of the Change

This PR adds methods needed for parsing JSON RPC responses from a received JSON string. In order to accomplish that the following changes have been made:

To ensure proper implementation new tests have been added:

Benefits

This change provides a symmetrical interface for both JSONRPCRequest and JSONRPCResponse. This provides an easy and consistent way to implement symmetrical interfaces, in which either side of an connection acts as a server-client hybrid, e.g. server that sends notifications to connected clients.

Possible Drawbacks

Should be none. All tests are passing (except for the Python 3.3 environment, but that is an upstream issue), however it may be reasonable to closely inspect whether error.setter update (in JSONRPC10Response and JSONRPC20Response) did not break anything.