@@ -1838,12 +1838,16 @@ func (ctx *context) Header(name string, value string) {
1838
1838
1839
1839
const contentTypeContextKey = "_iris_content_type"
1840
1840
1841
+ func shouldAppendCharset (cType string ) bool {
1842
+ return cType != ContentBinaryHeaderValue && cType != ContentWebassemblyHeaderValue
1843
+ }
1844
+
1841
1845
func (ctx * context ) contentTypeOnce (cType string , charset string ) {
1842
1846
if charset == "" {
1843
1847
charset = ctx .Application ().ConfigurationReadOnly ().GetCharset ()
1844
1848
}
1845
1849
1846
- if cType != ContentBinaryHeaderValue {
1850
+ if shouldAppendCharset ( cType ) {
1847
1851
cType += "; charset=" + charset
1848
1852
}
1849
1853
@@ -1869,7 +1873,7 @@ func (ctx *context) ContentType(cType string) {
1869
1873
}
1870
1874
// if doesn't contain a charset already then append it
1871
1875
if ! strings .Contains (cType , "charset" ) {
1872
- if cType != ContentBinaryHeaderValue {
1876
+ if shouldAppendCharset ( cType ) {
1873
1877
cType += "; charset=" + ctx .Application ().ConfigurationReadOnly ().GetCharset ()
1874
1878
}
1875
1879
}
@@ -3078,6 +3082,8 @@ func (ctx *context) View(filename string, optionalViewModel ...interface{}) erro
3078
3082
const (
3079
3083
// ContentBinaryHeaderValue header value for binary data.
3080
3084
ContentBinaryHeaderValue = "application/octet-stream"
3085
+ // ContentWebassemblyHeaderValue header value for web assembly files.
3086
+ ContentWebassemblyHeaderValue = "application/wasm"
3081
3087
// ContentHTMLHeaderValue is the string of text/html response header's content type value.
3082
3088
ContentHTMLHeaderValue = "text/html"
3083
3089
// ContentJSONHeaderValue header value for JSON data.
0 commit comments