Skip to content

Commit

Permalink
Merge pull request #11 from divan/master
Browse files Browse the repository at this point in the history
Add proper MIME type for JS scripts
  • Loading branch information
ubogdan authored Sep 23, 2021
2 parents 052a3c4 + 2ddb071 commit 2ce122a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func WrapHandler(h *webdav.Handler) buffalo.Handler {
case "doc.json":
doc, _ := swag.ReadDoc()
c.Response().Write([]byte(doc))
case "swagger-ui-bundle.js", "swagger-ui.js", "swagger-ui-standalone-preset.js":
// The browser needs to interpret JS as a JS scripts
c.Response().Header().Add("Content-Type", "application/javascript")
h.ServeHTTP(c.Response(), c.Request())
case "swagger-ui.css":
// The browser needs to interpret CSS as a stylesheet
c.Response().Header().Add("Content-Type", "text/css")
Expand Down

0 comments on commit 2ce122a

Please sign in to comment.