Skip to content

Commit bd6ed04

Browse files
committed
chi swagger
1 parent c9de1a6 commit bd6ed04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

coderd/coderd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,9 @@ func New(options *Options) *API {
590590
})
591591
})
592592
})
593+
// Swagger UI requires the URL trailing slash. Otherwise, the browser tries to load /assets
594+
// from http://localhost:8080/assets instead of http://localhost:8080/swagger/assets.
595+
r.Get("/swagger", http.RedirectHandler("/swagger/", http.StatusSeeOther).ServeHTTP)
593596
r.Get("/swagger/*", httpSwagger.Handler(httpSwagger.URL("/swagger/doc.json")))
594597

595598
r.NotFound(compressHandler(http.HandlerFunc(api.siteHandler.ServeHTTP)).ServeHTTP)

0 commit comments

Comments
 (0)