Support for JSON-RPC 1.0
FMCorz opened this issue · comments
I would prefer using version 2.0 altogether, but some of the clients I'm using are still on 1.0. This should not make a big difference altogether, I think what needs to be done is:
- Accepting to receive
error: null
for a valid request - Validate against the 1.0 schema
- Indicate the version to use to the client
Here is an example of a very hacky client, which sort of makes the request 1.0, and pretends the response is 2.0.
import json
from jsonrpcclient.clients.http_client import HTTPClient
class HTTPClient1_0(HTTPClient):
def validate_response(self, response):
data = json.loads(response.text)
if 'error' in data and data['error'] is None:
del data['error']
data['jsonrpc'] = '2.0'
response.text = json.dumps(data)
def send(self, request, **kwargs):
del request['jsonrpc']
return super().send(request, **kwargs)
Probably won't add this, this is an implementation of the 2.0 spec.