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
net/rpc/jsonrpc: client implementation is not compatible with JSON-RPC 1.0 spec #30188
Comments
/cc @robpike |
I don't see how to fix this without breaking things. I don't see how to leave this alone without breaking things. Help wanted. |
@stefangluszek are u sending a PR for this? |
No because the fix is not backward compatible. It's still the right fix but it will break the existing clients and servers. You would either have to upgrade both client and the server with the fix or make changes to your client to explicitly wrap the param in an array before passing it to |
The policy is we can't break things except under very special circumstances that I'm not convinced apply here. |
The usual way of fixing problems like that - is a switch "fixed_jsonrpc1_array_parameters_behaviour" :) in client struct. Defaulted to false value. With a plan to change default value to true in future. |
Yes adding a feature flag to protect the change would work, not pretty though. |
According to JSON-RPC 1.0 specification the params property should be an array of object. The canonical example of calling remote methods with JSON-RPC 1.0 is to send the parameters as one dimensional JSON array:
{"method": "concat", "params": ["foo", "bar"], "id": 123}
The GO's client implementation will always wrap the params property in an additional array:
{"method": "concat", "params": [["foo", "bar"]], "id": 123}
This works fine as long as both ends use the GO's implementation and expect the actual params to be the first element of the params array. It becomes a problem if you have another server implementation of JSON-RPC 1.0 but want to use GO's client to call remote methods.
I have worked around this issue locally by fixing it in my go fork.
The text was updated successfully, but these errors were encountered: