From 715f78e26a2d64ab52569867e0fd8b3bc7a4256f Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 9 Mar 2017 21:00:25 +0100 Subject: [PATCH] Properly encode json.RawMessage --- client/http_client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/http_client.go b/client/http_client.go index 7df09f249..5030323b5 100644 --- a/client/http_client.go +++ b/client/http_client.go @@ -72,7 +72,9 @@ func (c *ClientJSONRPC) Call(method string, params map[string]interface{}, resul // (handlers.go:176) on the server side encodedParams := make(map[string]interface{}) for k, v := range params { - encodedParams[k] = json.RawMessage(wire.JSONBytes(v)) + // log.Printf("%s: %v (%s)\n", k, v, string(wire.JSONBytes(v))) + bytes := json.RawMessage(wire.JSONBytes(v)) + encodedParams[k] = &bytes } request := types.RPCRequest{ JSONRPC: "2.0", @@ -84,6 +86,7 @@ func (c *ClientJSONRPC) Call(method string, params map[string]interface{}, resul if err != nil { return nil, err } + // log.Info(string(requestBytes)) requestBuf := bytes.NewBuffer(requestBytes) // log.Info(Fmt("RPC request to %v (%v): %v", c.remote, method, string(requestBytes))) httpResponse, err := c.client.Post(c.address, "text/json", requestBuf)