Chore: builtin right mime of .js (#1808)

This commit is contained in:
bobo liu 2021-12-08 13:38:25 +08:00 committed by GitHub
parent 08607fb6b4
commit 78e105f3b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

16
constant/mime/mime.go Normal file
View File

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

View File

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