diff options
Diffstat (limited to 'api4/context.go')
-rw-r--r-- | api4/context.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/api4/context.go b/api4/context.go index 1f27431d2..9f3822633 100644 --- a/api4/context.go +++ b/api4/context.go @@ -125,8 +125,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if err != nil { l4g.Info(utils.T("api.context.invalid_session.error"), err.Error()) - c.RemoveSessionCookie(w, r) - if h.requireSession { + if err.StatusCode == http.StatusInternalServerError { + c.Err = err + } else if h.requireSession { + c.RemoveSessionCookie(w, r) c.Err = model.NewAppError("ServeHTTP", "api.context.session_expired.app_error", nil, "token="+token, http.StatusUnauthorized) } } else if !session.IsOAuth && tokenLocation == app.TokenLocationQueryString { |