Skip to content

Commit

Permalink
refactor: Change name of error that is returned when implementation d…
Browse files Browse the repository at this point in the history
…oes not support method
  • Loading branch information
randuck-dev committed Nov 6, 2023
1 parent 716b97a commit bd60291
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()))
Expand Down
4 changes: 2 additions & 2 deletions internal/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit bd60291

Please sign in to comment.