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

Fix encoding request when params are nil #77

Closed
wants to merge 1 commit into from

Conversation

MarinX
Copy link

@MarinX MarinX commented Nov 7, 2019

Fixes #54

Summary of Changes

When calling method with args nil, the interface marshals into null, which gives us params: [null] and RPC server that does not require parameter will yield error.
This fix sets the params only if args are not nil, otherwise it will be an empty interface which will give us params: []

@coreydaley
Copy link
Contributor

Is there a test that can updated/added to verify this and ensure that we don't have any regressions in the future? (also need to fix the conflict)

@MarinX
Copy link
Author

MarinX commented Aug 19, 2023

Going to close this PR request because it's wrong.

The difference between jsonrpc 1 and jsonrpc 2 is that params may be omitted

The package rpc/v2/json2 contains a client which omits that field (readme also points rpc/v2 support for JSON-RPC 2.0 Specification) .

I was just using the wrong client (1.0) instead of the correct one(2.0)

@MarinX MarinX closed this Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

json.EncodeClientRequest for a method that has no arguments
2 participants