Skip to content

Commit

Permalink
chore(backend): rename function for clarity
Browse files Browse the repository at this point in the history
there's a typo and we now raise 404 on missing file
  • Loading branch information
prymitive committed Dec 27, 2018
1 parent 7cb5298 commit db9f28c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets.go
Expand Up @@ -77,7 +77,7 @@ func loadTemplate(t *template.Template, path string) *template.Template {
return t
}

func serverFileOrEmpty(path string, contentType string, c *gin.Context) {
func serveFileOr404(path string, contentType string, c *gin.Context) {
if path == "" {
c.Data(200, contentType, nil)
return
Expand Down
4 changes: 2 additions & 2 deletions main.go
Expand Up @@ -88,10 +88,10 @@ func setupRouter(router *gin.Engine) {
router.GET(getViewURL("/labelValues.json"), knownLabelValues)

router.GET(getViewURL("/custom.css"), func(c *gin.Context) {
serverFileOrEmpty(config.Config.Custom.CSS, "text/css", c)
serveFileOr404(config.Config.Custom.CSS, "text/css", c)
})
router.GET(getViewURL("/custom.js"), func(c *gin.Context) {
serverFileOrEmpty(config.Config.Custom.JS, "application/javascript", c)
serveFileOr404(config.Config.Custom.JS, "application/javascript", c)
})

router.NoRoute(notFound)
Expand Down

0 comments on commit db9f28c

Please sign in to comment.