Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app_test.go')
-rw-r--r--app_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/app_test.go b/app_test.go
index 3b476bdb..6da1e4fd 100644
--- a/app_test.go
+++ b/app_test.go
@@ -125,3 +125,21 @@ func TestHealthCheckMiddleware(t *testing.T) {
})
}
}
+
+func TestHandlePanicMiddleware(t *testing.T) {
+ next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ panic("on purpose")
+ })
+
+ ww := httptest.NewRecorder()
+ rr := httptest.NewRequest(http.MethodGet, "https://gitlab.io", nil)
+
+ handler := handlePanicMiddleware(next)
+
+ handler.ServeHTTP(ww, rr)
+
+ res := ww.Result()
+ res.Body.Close()
+
+ require.Equal(t, http.StatusInternalServerError, res.StatusCode)
+}