Skip to content

Commit

Permalink
fix duplicate api error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
broneks committed Nov 26, 2024
1 parent 27c9af5 commit 5f8ac0f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
4 changes: 4 additions & 0 deletions api/handle_http_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
)

func httpErrorHandler(err error, c echo.Context) {
if c.Response().Committed {
return
}

code := http.StatusInternalServerError
if he, ok := err.(*echo.HTTPError); ok {
code = he.Code
Expand Down
15 changes: 0 additions & 15 deletions api/resource/handle_not_found.go

This file was deleted.

2 changes: 0 additions & 2 deletions api/resource/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
)

func Routes(g *echo.Group, server *types.Server) {
g.RouteNotFound("/*", handleNotFound)

g.GET("/health", handleHealth(server))

v1 := g.Group("/v1", middleware.SetUserData())
Expand Down

0 comments on commit 5f8ac0f

Please sign in to comment.