Skip to content

enhancement: questionable default value for params #8

Description

@kroeplin

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.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions