mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
parent
8b7220f97c
commit
c50c67783f
@ -1,10 +1,8 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
- tip
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
install:
|
||||
- go get -v golang.org/x/lint/golint
|
||||
script:
|
||||
|
12
echo.go
12
echo.go
@ -354,10 +354,14 @@ func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) {
|
||||
Message: http.StatusText(http.StatusInternalServerError),
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #1426
|
||||
code := he.Code
|
||||
message := he.Message
|
||||
if e.Debug {
|
||||
he.Message = err.Error()
|
||||
} else if m, ok := he.Message.(string); ok {
|
||||
he.Message = Map{"message": m}
|
||||
message = err.Error()
|
||||
} else if m, ok := message.(string); ok {
|
||||
message = Map{"message": m}
|
||||
}
|
||||
|
||||
// Send response
|
||||
@ -365,7 +369,7 @@ func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) {
|
||||
if c.Request().Method == http.MethodHead { // Issue #608
|
||||
err = c.NoContent(he.Code)
|
||||
} else {
|
||||
err = c.JSON(he.Code, he.Message)
|
||||
err = c.JSON(code, message)
|
||||
}
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
|
Loading…
Reference in New Issue
Block a user