Skip to content

Commit 131f3bc

Browse files
Copilotfiftin
andcommitted
Fix blank page issue when accessing Swagger API docs at /swagger/
Co-authored-by: fiftin <[email protected]>
1 parent f255531 commit 131f3bc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

api/router.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,13 @@ func servePublic(w http.ResponseWriter, r *http.Request) {
561561
return
562562
}
563563

564+
// Check if this is a request for the swagger UI
565+
swaggerPath := path.Join(webPath, "swagger")
566+
if reqPath == swaggerPath || reqPath == swaggerPath+"/" {
567+
serveFile(w, r, "swagger/index.html")
568+
return
569+
}
570+
564571
if !strings.Contains(reqPath, ".") {
565572
serveFile(w, r, "index.html")
566573
return

0 commit comments

Comments
 (0)