From 8fd243ee2303946dd520dd87513bbe0ec4184301 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 17 Mar 2015 17:38:05 -0400 Subject: Add JSON RPC batch support http://www.jsonrpc.org/specification#batch --- rpc/util.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'rpc/util.go') diff --git a/rpc/util.go b/rpc/util.go index e5610dc2c..6eb1faefb 100644 --- a/rpc/util.go +++ b/rpc/util.go @@ -21,7 +21,7 @@ import ( "fmt" "io" "math/big" - "net/http" + // "net/http" "reflect" "time" @@ -106,24 +106,6 @@ func (self JsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error) return writer.Write(payload) } -func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error) { - var reqParsed RpcRequest - - // Convert JSON to native types - d := json.NewDecoder(req.Body) - defer req.Body.Close() - err := d.Decode(&reqParsed) - - if err != nil { - rpclogger.Errorln("Error decoding JSON: ", err) - return reqParsed, err - } - - rpclogger.DebugDetailf("Parsed request: %s", reqParsed) - - return reqParsed, nil -} - func toHex(b []byte) string { hex := common.Bytes2Hex(b) // Prefer output of "0x0" instead of "0x" -- cgit v1.2.3 From 67c9d9c2fa6d1cb74188dccf7e25422db72983c8 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 17 Mar 2015 20:14:19 -0400 Subject: Remove JsonWrapper --- rpc/util.go | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'rpc/util.go') diff --git a/rpc/util.go b/rpc/util.go index 6eb1faefb..413ec4887 100644 --- a/rpc/util.go +++ b/rpc/util.go @@ -19,9 +19,7 @@ package rpc import ( "encoding/json" "fmt" - "io" "math/big" - // "net/http" "reflect" "time" @@ -33,8 +31,6 @@ import ( var rpclogger = logger.NewLogger("RPC") -type JsonWrapper struct{} - // Unmarshal state is a helper method which has the ability to decode messsages // that use the `defaultBlock` (https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter) // For example a `call`: [{to: "0x....", data:"0x..."}, "latest"]. The first argument is the transaction @@ -94,18 +90,6 @@ func UnmarshalRawMessages(b []byte, iface interface{}, number *int64) (err error return nil } -func (self JsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error) { - var payload []byte - payload, err = json.MarshalIndent(v, "", "\t") - if err != nil { - rpclogger.Fatalln("Error marshalling JSON", err) - return 0, err - } - rpclogger.DebugDetailf("Sending payload: %s", payload) - - return writer.Write(payload) -} - func toHex(b []byte) string { hex := common.Bytes2Hex(b) // Prefer output of "0x0" instead of "0x" -- cgit v1.2.3