Skip to content

Commit 3c23276

Browse files
fix(api): return proper error payload on API not found (#51)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
1 parent 3462451 commit 3c23276

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/http.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ func (app *Application) Start(listen string) error {
250250
router.NoRoute(func(c *gin.Context) {
251251
path := c.Request.URL.Path
252252
if strings.HasPrefix(path, "/api") {
253-
c.AbortWithStatus(http.StatusNotFound)
253+
c.AbortWithStatusJSON(
254+
http.StatusNotFound,
255+
NewErrorResponse("route not found"),
256+
)
254257
} else {
255258
c.File(defaultFile)
256259
}

0 commit comments

Comments
 (0)