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

enhancement: questionable default value for params #8

Open
kroeplin opened this issue Nov 22, 2011 · 0 comments
Open

enhancement: questionable default value for params #8

kroeplin opened this issue Nov 22, 2011 · 0 comments

Comments

@kroeplin
Copy link

The methods 'request' and 'notify' of the class 'RPCClient' in 'rpc.py' use an empty array as default value for 'params'.

The specification states: "This member MAY be omitted."

With a default value of 'None' the following code (with ugly repetition?) would send better requests without parameters:

        if params is None:
            self.writer.write_value({'jsonrpc': '2.0', 'method': method, 'id': request_id})
        else:
            self.writer.write_value({'jsonrpc': '2.0', 'method': method, 'params': params, 'id': request_id})

and

        if params is None:
            self.writer.write_value({'method': method})
        else:
            self.writer.write_value({'method': method, 'params': params})

(By the way: the 'jsonrpc': '2.0' part is currently missing for notifications.)

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

1 participant