From 5f7df183b428fcf1d09f49ef6a2b6584b20e7c6f Mon Sep 17 00:00:00 2001 From: Lukas Schulte Pelkum Date: Thu, 29 Apr 2021 14:57:08 +0200 Subject: [PATCH] Force specific Content-Type value for JS (#6) --- internal/web/web.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/web/web.go b/internal/web/web.go index 577aa04..c6fd663 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -31,6 +31,9 @@ func Serve() error { router.GET("/{path:*}", func(ctx *fasthttp.RequestCtx) { path := string(ctx.Path()) if !strings.HasPrefix(path, "/api") && (strings.Count(path, "/") == 1 || strings.HasPrefix(path, "/assets")) { + if strings.HasPrefix(path, "/assets/js/") { + ctx.SetContentType("text/javascript") + } frontend(ctx) return }