mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 05:50:54 +08:00
Corrected obsolete 'text/javascript' mime to 'application/javascript'
This commit is contained in:
parent
3de31613a1
commit
23c1ebfac9
@ -35,7 +35,7 @@ func GetMimetype(filename string, data []byte) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if filepath.Ext(filename) == ".js" && strings.HasPrefix(result, "text/plain") {
|
if filepath.Ext(filename) == ".js" && strings.HasPrefix(result, "text/plain") {
|
||||||
result = strings.Replace(result, "text/plain", "text/javascript", 1)
|
result = strings.Replace(result, "text/plain", "application/javascript", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if result == "" {
|
if result == "" {
|
||||||
|
@ -14,7 +14,7 @@ func TestGetMimetype(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
// TODO: Add test cases.
|
// TODO: Add test cases.
|
||||||
{"css", args{"test.css", []byte("body{margin:0;padding:0;background-color:#d579b2}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;background-color:#ededed}#nav{padding:30px}#nav a{font-weight:700;color:#2c\n3e50}#nav a.router-link-exact-active{color:#42b983}.hello[data-v-4e26ad49]{margin:10px 0}")}, "text/css; charset=utf-8"},
|
{"css", args{"test.css", []byte("body{margin:0;padding:0;background-color:#d579b2}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;background-color:#ededed}#nav{padding:30px}#nav a{font-weight:700;color:#2c\n3e50}#nav a.router-link-exact-active{color:#42b983}.hello[data-v-4e26ad49]{margin:10px 0}")}, "text/css; charset=utf-8"},
|
||||||
{"js", args{"test.js", []byte("let foo = 'bar'; console.log(foo);")}, "text/javascript; charset=utf-8"},
|
{"js", args{"test.js", []byte("let foo = 'bar'; console.log(foo);")}, "application/javascript; charset=utf-8"},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user