Skip to content

Commit d4e38da

Browse files
committed
fix #1440
Former-commit-id: aaf275d4eedca95ef8d8f8ef79b1ff2eecf2fbc9
1 parent 3093d65 commit d4e38da

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ If you discover a security vulnerability within Iris, please send an e-mail to [
8181

8282
## License
8383

84-
The project name "Iris" was inspired by the Greek mythology.
84+
This project is licensed under the [BSD 3-clause license](LICENSE), just like the Go project itself.
8585

86-
Iris Web Framework is free and open-source software licensed under the [3-Clause BSD License](LICENSE).
86+
The project name "Iris" was inspired by the Greek mythology.
8787

8888
## Stargazers over time
8989

context/context.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -1838,12 +1838,16 @@ func (ctx *context) Header(name string, value string) {
18381838

18391839
const contentTypeContextKey = "_iris_content_type"
18401840

1841+
func shouldAppendCharset(cType string) bool {
1842+
return cType != ContentBinaryHeaderValue && cType != ContentWebassemblyHeaderValue
1843+
}
1844+
18411845
func (ctx *context) contentTypeOnce(cType string, charset string) {
18421846
if charset == "" {
18431847
charset = ctx.Application().ConfigurationReadOnly().GetCharset()
18441848
}
18451849

1846-
if cType != ContentBinaryHeaderValue {
1850+
if shouldAppendCharset(cType) {
18471851
cType += "; charset=" + charset
18481852
}
18491853

@@ -1869,7 +1873,7 @@ func (ctx *context) ContentType(cType string) {
18691873
}
18701874
// if doesn't contain a charset already then append it
18711875
if !strings.Contains(cType, "charset") {
1872-
if cType != ContentBinaryHeaderValue {
1876+
if shouldAppendCharset(cType) {
18731877
cType += "; charset=" + ctx.Application().ConfigurationReadOnly().GetCharset()
18741878
}
18751879
}
@@ -3078,6 +3082,8 @@ func (ctx *context) View(filename string, optionalViewModel ...interface{}) erro
30783082
const (
30793083
// ContentBinaryHeaderValue header value for binary data.
30803084
ContentBinaryHeaderValue = "application/octet-stream"
3085+
// ContentWebassemblyHeaderValue header value for web assembly files.
3086+
ContentWebassemblyHeaderValue = "application/wasm"
30813087
// ContentHTMLHeaderValue is the string of text/html response header's content type value.
30823088
ContentHTMLHeaderValue = "text/html"
30833089
// ContentJSONHeaderValue header value for JSON data.

0 commit comments

Comments
 (0)