diff options
author | Wim <wim@42.be> | 2021-05-30 00:25:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-30 00:25:30 +0200 |
commit | 4091b6f6b4fe01876f8720332675f9c69be39541 (patch) | |
tree | 07a1f2b2eeba6fb680b5edc19d2d38ec81243c0a /vendor/github.com/labstack/echo/v4/middleware/timeout.go | |
parent | 766f35554e16ee5462370be714ef29b71745d478 (diff) | |
download | matterbridge-msglm-4091b6f6b4fe01876f8720332675f9c69be39541.tar.gz matterbridge-msglm-4091b6f6b4fe01876f8720332675f9c69be39541.tar.bz2 matterbridge-msglm-4091b6f6b4fe01876f8720332675f9c69be39541.zip |
Update vendor (#1498)
Diffstat (limited to 'vendor/github.com/labstack/echo/v4/middleware/timeout.go')
-rw-r--r-- | vendor/github.com/labstack/echo/v4/middleware/timeout.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vendor/github.com/labstack/echo/v4/middleware/timeout.go b/vendor/github.com/labstack/echo/v4/middleware/timeout.go index 5d23ff45..fb8ae421 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/timeout.go +++ b/vendor/github.com/labstack/echo/v4/middleware/timeout.go @@ -1,5 +1,3 @@ -// +build go1.13 - package middleware import ( @@ -94,6 +92,15 @@ func (t echoHandlerFuncWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Reques originalWriter := t.ctx.Response().Writer t.ctx.Response().Writer = rw + // in case of panic we restore original writer and call panic again + // so it could be handled with global middleware Recover() + defer func() { + if err := recover(); err != nil { + t.ctx.Response().Writer = originalWriter + panic(err) + } + }() + err := t.handler(t.ctx) if ctxErr := r.Context().Err(); ctxErr == context.DeadlineExceeded { if err != nil && t.errHandler != nil { |