Browse Source

Properly encode json.RawMessage

pull/456/head
Ethan Frey 8 years ago
committed by Anton Kaliaev
parent
commit
715f78e26a
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      client/http_client.go

+ 4
- 1
client/http_client.go View File

@ -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)


Loading…
Cancel
Save