Skip to content

Commit

Permalink
specify method post in rpc calls (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeimonDB authored Oct 17, 2022
1 parent 695ff13 commit 45eaa67
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"net/http"
)

var requestID = int64(0)
Expand Down Expand Up @@ -45,6 +46,7 @@ func (r *Request) RpcCall(result interface{}, method string, params interface{})
req := &RpcRequest{JsonRpc: JsonRpcVersion, Method: method, Params: params, Id: genID()}
var resp *RpcResponse
_, err := r.Execute(context.Background(), NewReqBuilder().
Method(http.MethodPost).
WriteTo(&resp).
Body(req).
Build())
Expand All @@ -61,6 +63,7 @@ func (r *Request) RpcCallRaw(method string, params interface{}) ([]byte, error)
req := &RpcRequest{JsonRpc: JsonRpcVersion, Method: method, Params: params, Id: genID()}
var resp *RpcResponseRaw
_, err := r.Execute(context.Background(), NewReqBuilder().
Method(http.MethodPost).
WriteTo(&resp).
Body(req).
Build())
Expand All @@ -76,6 +79,7 @@ func (r *Request) RpcCallRaw(method string, params interface{}) ([]byte, error)
func (r *Request) RpcBatchCall(requests RpcRequests) ([]RpcResponse, error) {
var resp []RpcResponse
_, err := r.Execute(context.Background(), NewReqBuilder().
Method(http.MethodPost).
WriteTo(&resp).
Body(requests.fillDefaultValues()).
Build())
Expand Down

0 comments on commit 45eaa67

Please sign in to comment.