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

Differentiate calls with no params and calls with empty list param #12

Merged

Conversation

yanivmo
Copy link
Contributor

@yanivmo yanivmo commented Aug 19, 2020

This change set proposes adding support for method calls with an empty array of positional arguments.

Rationale

When issuing a call with positional arguments, the current implementation doesn't differentiate between the calls missing the params property completely and the calls with the params property containing an empty array. In both cases, the eventual JSON-RPC request won't contain the params property.

Unfortunately there are services that require messages with empty params, as this behavior does not contradict the official JSON-RPC specification and its handling is at the server's discretion.

Proposed solution

If JsonRpcClient::CallMethod is invoked with two arguments: ID and the method name, generate a request without the params property. If JsonRpcClient::CallMethod is invoked with three arguments and the params argument is an empty vector, then generate a request with the params property containing an empty array.

@cinemast cinemast merged commit 374e165 into jsonrpcx:master Aug 22, 2020
@cinemast
Copy link
Contributor

Thanks!

@yanivmo yanivmo deleted the differentiate-empty-and-no-params branch September 2, 2020 09:05
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

Successfully merging this pull request may close these issues.

2 participants