From 8fa4cb2f77bb51657fa63afb474dee7c2d518b0a Mon Sep 17 00:00:00 2001 From: illionillion Date: Mon, 24 Nov 2025 14:59:35 +0900 Subject: [PATCH] test: add /swagger/ index.html response test for safety --- swagger_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/swagger_test.go b/swagger_test.go index f3a3b95..8e6afba 100644 --- a/swagger_test.go +++ b/swagger_test.go @@ -85,6 +85,11 @@ func TestWrapCustomHandler(t *testing.T) { w := performRequest(http.MethodGet, "/swagger", router) assert.Equal(t, http.StatusOK, w.Code) assert.Contains(t, w.Body.String(), "Swagger UI") + + // Test: /swagger/ should also return index.html + wSlash := performRequest(http.MethodGet, "/swagger/", router) + assert.Equal(t, http.StatusOK, wSlash.Code) + assert.Contains(t, wSlash.Body.String(), "Swagger UI") } func TestDisablingWrapHandler(t *testing.T) {