From bf85ce32804d4a428b42c0e19aaa5028cc8e8129 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 23 Jul 2024 20:29:46 +0100 Subject: [PATCH] request: Request -> RawRequest RawRequest is more consistent with the parameters for this function (RawRequest, RawResponse), and also make it clear that this is kind difficult to be used directly. --- request.go | 4 ++-- request_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/request.go b/request.go index 116518b..c3b6d60 100644 --- a/request.go +++ b/request.go @@ -113,7 +113,7 @@ func (c *RequestClient) doRequest(command string, params ...string) (response Ra var buf bytes.Buffer for _, req := range requests { - resp, err := c.Request(req) + resp, err := c.RawRequest(req) if err != nil { return nil, fmt.Errorf("error while doing request: %w", err) } @@ -167,7 +167,7 @@ func NewClient(socket string) *RequestClient { // '[]byte("dispatch exec kitty")'. // Keep in mind that there is no validation. In case of an invalid request, the // response will generally be something different from "ok". -func (c *RequestClient) Request(request RawRequest) (response RawResponse, err error) { +func (c *RequestClient) RawRequest(request RawRequest) (response RawResponse, err error) { if len(request) == 0 { return nil, errors.New("empty request") } diff --git a/request_test.go b/request_test.go index d1702e2..2aaf825 100644 --- a/request_test.go +++ b/request_test.go @@ -131,9 +131,9 @@ func TestValidateResponse(t *testing.T) { } } -func TestRequest(t *testing.T) { +func TestRawRequest(t *testing.T) { testCommandRR(t, func() (RawResponse, error) { - return c.Request([]byte("dispatch exec")) + return c.RawRequest([]byte("splash")) }) }