Prevent duplicate error responses.

This commit is contained in:
mikestefanello 2021-12-11 19:32:27 -05:00
parent 58e75cf7a6
commit bbf27d1b04

View file

@ -11,6 +11,10 @@ type Error struct {
} }
func (e *Error) Get(err error, c echo.Context) { func (e *Error) Get(err error, c echo.Context) {
if c.Response().Committed {
return
}
code := http.StatusInternalServerError code := http.StatusInternalServerError
if he, ok := err.(*echo.HTTPError); ok { if he, ok := err.(*echo.HTTPError); ok {
code = he.Code code = he.Code