(ctx context.Context, op *requestOp, msg interface{})
| 88 | } |
| 89 | |
| 90 | func (c *Client) sendHTTP(ctx context.Context, op *requestOp, msg interface{}) error { |
| 91 | hc := c.writeConn.(*httpConn) |
| 92 | respBody, err := hc.doRequest(ctx, msg) |
| 93 | if respBody != nil { |
| 94 | defer respBody.Close() |
| 95 | } |
| 96 | |
| 97 | if err != nil { |
| 98 | if respBody != nil { |
| 99 | buf := new(bytes.Buffer) |
| 100 | if _, err2 := buf.ReadFrom(respBody); err2 == nil { |
| 101 | return fmt.Errorf("%v %v", err, buf.String()) |
| 102 | } |
| 103 | } |
| 104 | return err |
| 105 | } |
| 106 | var respmsg jsonrpcMessage |
| 107 | if err := json.NewDecoder(respBody).Decode(&respmsg); err != nil { |
| 108 | return err |
| 109 | } |
| 110 | op.resp <- &respmsg |
| 111 | return nil |
| 112 | } |
| 113 | |
| 114 | func (c *Client) sendBatchHTTP(ctx context.Context, op *requestOp, msgs []*jsonrpcMessage) error { |
| 115 | hc := c.writeConn.(*httpConn) |
no test coverage detected