1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-05 03:07:38 +00:00

change the JS MIME to text/javascript instead of application/javascript as https://github.com/golang/go/issues/32351

Former-commit-id: 761be7901fff65ef0ca6e3ea4339ff59f569cf75
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-04-27 12:28:30 +03:00
parent 346ca2a219
commit f75ec4e67c
11 changed files with 79 additions and 37 deletions

View File

@@ -16,7 +16,7 @@ type resource string
func (r resource) contentType() string {
switch filepath.Ext(r.String()) {
case ".js":
return "application/javascript"
return "text/javascript"
case ".css":
return "text/css"
case ".ico":

View File

@@ -18,7 +18,7 @@ type resource string
func (r resource) contentType() string {
switch filepath.Ext(r.String()) {
case ".js":
return "application/javascript"
return "text/javascript"
case ".css":
return "text/css"
case ".ico":

View File

@@ -20,7 +20,7 @@ type resource string
func (r resource) contentType() string {
switch filepath.Ext(r.String()) {
case ".js":
return "application/javascript"
return "text/javascript"
case ".css":
return "text/css"
case ".ico":

View File

@@ -15,7 +15,7 @@ type resource string
func (r resource) contentType() string {
switch filepath.Ext(r.String()) {
case ".js":
return "application/javascript"
return "text/javascript"
case ".css":
return "text/css"
default:

View File

@@ -14,7 +14,7 @@ type resource string
func (r resource) contentType() string {
switch filepath.Ext(r.String()) {
case ".js":
return "application/javascript"
return "text/javascript"
case ".css":
return "text/css"
case ".ico":

View File

@@ -97,7 +97,7 @@ func newApp() *iris.Application {
// Markdown: for text/mardown,
// Binary: for application/octet-stream,
// YAML: for application/x-yaml,
// JSONP: for application/javascript
// JSONP: for text/javascript
// Other: for anything else,
JSON: jsonAndXML, // for application/json
XML: jsonAndXML, // for application/xml or text/xml

View File

@@ -49,7 +49,7 @@ func main() {
Age: 25,
}
// Manually setting a content type: ctx.ContentType("application/javascript")
// Manually setting a content type: ctx.ContentType("text/javascript")
ctx.JSON(u)
})