rpc: collapse Caller and HTTPClient interfaces. (#7548)

These two interfaces are identical, and besides HTTPClient being confusingly
named, all but one location uses Caller. Update that one location, and drop the
redundant interface.
This commit is contained in:
M. J. Fromberger
2022-01-10 11:52:52 -08:00
committed by GitHub
parent 211d755aca
commit 8e58c564c0
2 changed files with 1 additions and 9 deletions

View File

@@ -106,12 +106,6 @@ func (u parsedURL) GetTrimmedURL() string {
//-------------------------------------------------------------
// HTTPClient is a common interface for JSON-RPC HTTP clients.
type HTTPClient interface {
// Call calls the given method with the params and returns a result.
Call(ctx context.Context, method string, params map[string]interface{}, result interface{}) (interface{}, error)
}
// Caller implementers can facilitate calling the JSON-RPC endpoint.
type Caller interface {
Call(ctx context.Context, method string, params map[string]interface{}, result interface{}) (interface{}, error)
@@ -134,8 +128,6 @@ type Client struct {
nextReqID int
}
var _ HTTPClient = (*Client)(nil)
// Both Client and RequestBatch can facilitate calls to the JSON
// RPC endpoint.
var _ Caller = (*Client)(nil)

View File

@@ -187,7 +187,7 @@ func echoDataBytesViaHTTP(ctx context.Context, cl client.Caller, bytes tmbytes.H
return result.Value, nil
}
func testWithHTTPClient(ctx context.Context, t *testing.T, cl client.HTTPClient) {
func testWithHTTPClient(ctx context.Context, t *testing.T, cl client.Caller) {
val := testVal
got, err := echoViaHTTP(ctx, cl, val)
require.NoError(t, err)