Skip to content

Commit

Permalink
request: Request -> RawRequest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thiagokokada committed Jul 23, 2024
1 parent 702a105 commit bf85ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
})
}

Expand Down

0 comments on commit bf85ce3

Please sign in to comment.