Skip to content

Commit

Permalink
Assign StatusBadRequest code for http bind error
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-github-robot authored Mar 4, 2024
2 parents d2c5513 + 2e78393 commit bca3a7c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ func EndRequestWithLog(c echo.Context, reqID string, err error, responseData int
details.Status = "Error"
details.ErrorResponse = err.Error()
RequestMap.Store(reqID, details)
return c.JSON(http.StatusInternalServerError, map[string]string{"message": err.Error()})
if responseData == nil {
return c.JSON(http.StatusBadRequest, map[string]string{"message": err.Error()})
} else {
return c.JSON(http.StatusInternalServerError, map[string]string{"message": err.Error()})
}
}

details.Status = "Success"
Expand Down

0 comments on commit bca3a7c

Please sign in to comment.