Skip to content

Commit 2ce122a

Browse files
authored
Merge pull request #11 from divan/master
Add proper MIME type for JS scripts
2 parents 052a3c4 + 2ddb071 commit 2ce122a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

swagger.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ func WrapHandler(h *webdav.Handler) buffalo.Handler {
4141
case "doc.json":
4242
doc, _ := swag.ReadDoc()
4343
c.Response().Write([]byte(doc))
44+
case "swagger-ui-bundle.js", "swagger-ui.js", "swagger-ui-standalone-preset.js":
45+
// The browser needs to interpret JS as a JS scripts
46+
c.Response().Header().Add("Content-Type", "application/javascript")
47+
h.ServeHTTP(c.Response(), c.Request())
4448
case "swagger-ui.css":
4549
// The browser needs to interpret CSS as a stylesheet
4650
c.Response().Header().Add("Content-Type", "text/css")

0 commit comments

Comments
 (0)