diff --git a/constant/mime/mime.go b/constant/mime/mime.go new file mode 100644 index 000000000..431457be8 --- /dev/null +++ b/constant/mime/mime.go @@ -0,0 +1,16 @@ +package mime + +import ( + "mime" +) + +var consensusMimes = map[string]string{ + // rfc4329: text/javascript is obsolete, so we need to overwrite mime's builtin + ".js": "application/javascript; charset=utf-8", +} + +func init() { + for ext, typ := range consensusMimes { + mime.AddExtensionType(ext, typ) + } +} diff --git a/hub/route/server.go b/hub/route/server.go index e01696bed..c38ca7e10 100644 --- a/hub/route/server.go +++ b/hub/route/server.go @@ -9,6 +9,7 @@ import ( "time" C "github.com/Dreamacro/clash/constant" + _ "github.com/Dreamacro/clash/constant/mime" "github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/tunnel/statistic"