From bd60291585c03911452d5bf457138e5d142ffa7b Mon Sep 17 00:00:00 2001 From: Raphael Neumann Date: Mon, 6 Nov 2023 22:14:10 +0100 Subject: [PATCH] refactor: Change name of error that is returned when implementation does not support method --- internal/http/http.go | 4 ++-- internal/http/http_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/http/http.go b/internal/http/http.go index 6ef7d09..4cb8047 100644 --- a/internal/http/http.go +++ b/internal/http/http.go @@ -22,7 +22,7 @@ var ErrConnectionIsNil = errors.New("expected connection to be set, was nil") var ErrInvalidHeaderFormat = errors.New("invalid header format detected. Expected format: \"key: value\"") -var ErrMethodNotImplemented = errors.New("the implementation does not support the method") +var ErrImplementationDoesNotSupportMethod = errors.New("the implementation does not support the method") type Client interface { Get(string) (Response, error) @@ -36,7 +36,7 @@ var supported_methods = []string{"GET", "HEAD"} func (hc *HttpClient) Do(request Request) (Response, error) { if !slices.Contains(supported_methods, request.Method) { - return Response{}, ErrMethodNotImplemented + return Response{}, ErrImplementationDoesNotSupportMethod } written, err := hc.Write([]byte(request.ToRaw())) diff --git a/internal/http/http_test.go b/internal/http/http_test.go index 5f9fca6..87ff87b 100644 --- a/internal/http/http_test.go +++ b/internal/http/http_test.go @@ -68,8 +68,8 @@ func TestDo(t *testing.T) { _, err := c.Do(request) - if err != ErrMethodNotImplemented { - t.Errorf("got %s want %s", err, ErrMethodNotImplemented) + if err != ErrImplementationDoesNotSupportMethod { + t.Errorf("got %s want %s", err, ErrImplementationDoesNotSupportMethod) } }