chore(backend): rename function for clarity

there's a typo and we now raise 404 on missing file
This commit is contained in:
Łukasz Mierzwa
2018-12-27 21:20:44 +01:00
parent 7cb5298ae3
commit db9f28cdf4
2 changed files with 3 additions and 3 deletions

View File

@@ -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

View File

@@ -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)