Browse Source

RawMessage fix

pull/456/head
Ethan Buchman 9 years ago
parent
commit
14735d5eb5
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      types/types.go

+ 6
- 2
types/types.go View File

@ -49,11 +49,15 @@ type RPCResponse struct {
} }
func NewRPCResponse(id string, res interface{}, err string) RPCResponse { func NewRPCResponse(id string, res interface{}, err string) RPCResponse {
raw := json.RawMessage(wire.JSONBytes(res))
var raw *json.RawMessage
if res != nil {
rawMsg := json.RawMessage(wire.JSONBytes(res))
raw = &rawMsg
}
return RPCResponse{ return RPCResponse{
JSONRPC: "2.0", JSONRPC: "2.0",
ID: id, ID: id,
Result: &raw,
Result: raw,
Error: err, Error: err,
} }
} }


Loading…
Cancel
Save