From 1273feda819203ec2e38212f9f2d27aaf90c229e Mon Sep 17 00:00:00 2001 From: shirolimit Date: Fri, 12 Jun 2020 09:12:10 +0300 Subject: [PATCH] Add Version to JSON-RPC client request --- transport/http/jsonrpc/client.go | 2 +- transport/http/jsonrpc/client_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/transport/http/jsonrpc/client.go b/transport/http/jsonrpc/client.go index 4d8fe303d..07b673d62 100644 --- a/transport/http/jsonrpc/client.go +++ b/transport/http/jsonrpc/client.go @@ -164,7 +164,7 @@ func (c Client) Endpoint() endpoint.Endpoint { return nil, err } rpcReq := clientRequest{ - JSONRPC: "", + JSONRPC: Version, Method: c.method, Params: params, ID: c.requestID.Generate(), diff --git a/transport/http/jsonrpc/client_test.go b/transport/http/jsonrpc/client_test.go index 3b4f1ea51..bbc37485b 100644 --- a/transport/http/jsonrpc/client_test.go +++ b/transport/http/jsonrpc/client_test.go @@ -133,6 +133,9 @@ func TestClientHappyPath(t *testing.T) { if id, _ := requestAtServer.ID.Int(); id != wantID { t.Fatalf("Request ID at server: want=%d, got=%d", wantID, id) } + if requestAtServer.JSONRPC != jsonrpc.Version { + t.Fatalf("JSON-RPC version at server: want=%s, got=%s", jsonrpc.Version, requestAtServer.JSONRPC) + } var paramsAtServer addRequest err = json.Unmarshal(requestAtServer.Params, ¶msAtServer)