test: add /swagger/ index.html response test for safety

This commit is contained in:
illionillion 2025-11-24 14:59:35 +09:00
parent 48b8bcf40c
commit 8fa4cb2f77
1 changed files with 5 additions and 0 deletions

View File

@ -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(), "<title>Swagger UI</title>")
// 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(), "<title>Swagger UI</title>")
}
func TestDisablingWrapHandler(t *testing.T) {