Skip to content

Commit

Permalink
Chore: builtin right mime of .js (#1808)
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeboboliu authored Dec 8, 2021
1 parent 08607fb commit 78e105f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions constant/mime/mime.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
1 change: 1 addition & 0 deletions hub/route/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 78e105f

Please sign in to comment.