Skip to content

Commit

Permalink
Add Version to JSON-RPC client request (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
shirolimit committed Jun 15, 2020
1 parent ef2f77e commit b1d0a5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion transport/http/jsonrpc/client.go
Expand Up @@ -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(),
Expand Down
3 changes: 3 additions & 0 deletions transport/http/jsonrpc/client_test.go
Expand Up @@ -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, &paramsAtServer)
Expand Down

0 comments on commit b1d0a5d

Please sign in to comment.