Skip to content

Commit

Permalink
refactor a bit encodeError
Browse files Browse the repository at this point in the history
Signed-off-by: mteodor <mirko.teodorovic@gmail.com>
  • Loading branch information
mteodor committed Feb 8, 2022
1 parent 967e9c2 commit 4ef247a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions readers/api/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ func encodeResponse(_ context.Context, w http.ResponseWriter, response interface
func encodeError(_ context.Context, err error, w http.ResponseWriter) {
switch {
case errors.Contains(err, nil):
case errors.Contains(err, errors.ErrInvalidQueryParams):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(err, errors.ErrMalformedEntity):
case errors.Contains(err, errors.ErrInvalidQueryParams),
errors.Contains(err, errors.ErrMalformedEntity):
w.WriteHeader(http.StatusBadRequest)
case errors.Contains(err, errors.ErrAuthentication):
w.WriteHeader(http.StatusUnauthorized)
Expand Down

0 comments on commit 4ef247a

Please sign in to comment.