mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
parent
3093d65363
commit
d4e38da3ad
|
@ -81,9 +81,9 @@ If you discover a security vulnerability within Iris, please send an e-mail to [
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The project name "Iris" was inspired by the Greek mythology.
|
This project is licensed under the [BSD 3-clause license](LICENSE), just like the Go project itself.
|
||||||
|
|
||||||
Iris Web Framework is free and open-source software licensed under the [3-Clause BSD License](LICENSE).
|
The project name "Iris" was inspired by the Greek mythology.
|
||||||
|
|
||||||
## Stargazers over time
|
## Stargazers over time
|
||||||
|
|
||||||
|
|
|
@ -1838,12 +1838,16 @@ func (ctx *context) Header(name string, value string) {
|
||||||
|
|
||||||
const contentTypeContextKey = "_iris_content_type"
|
const contentTypeContextKey = "_iris_content_type"
|
||||||
|
|
||||||
|
func shouldAppendCharset(cType string) bool {
|
||||||
|
return cType != ContentBinaryHeaderValue && cType != ContentWebassemblyHeaderValue
|
||||||
|
}
|
||||||
|
|
||||||
func (ctx *context) contentTypeOnce(cType string, charset string) {
|
func (ctx *context) contentTypeOnce(cType string, charset string) {
|
||||||
if charset == "" {
|
if charset == "" {
|
||||||
charset = ctx.Application().ConfigurationReadOnly().GetCharset()
|
charset = ctx.Application().ConfigurationReadOnly().GetCharset()
|
||||||
}
|
}
|
||||||
|
|
||||||
if cType != ContentBinaryHeaderValue {
|
if shouldAppendCharset(cType) {
|
||||||
cType += "; charset=" + charset
|
cType += "; charset=" + charset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1869,7 +1873,7 @@ func (ctx *context) ContentType(cType string) {
|
||||||
}
|
}
|
||||||
// if doesn't contain a charset already then append it
|
// if doesn't contain a charset already then append it
|
||||||
if !strings.Contains(cType, "charset") {
|
if !strings.Contains(cType, "charset") {
|
||||||
if cType != ContentBinaryHeaderValue {
|
if shouldAppendCharset(cType) {
|
||||||
cType += "; charset=" + ctx.Application().ConfigurationReadOnly().GetCharset()
|
cType += "; charset=" + ctx.Application().ConfigurationReadOnly().GetCharset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3078,6 +3082,8 @@ func (ctx *context) View(filename string, optionalViewModel ...interface{}) erro
|
||||||
const (
|
const (
|
||||||
// ContentBinaryHeaderValue header value for binary data.
|
// ContentBinaryHeaderValue header value for binary data.
|
||||||
ContentBinaryHeaderValue = "application/octet-stream"
|
ContentBinaryHeaderValue = "application/octet-stream"
|
||||||
|
// ContentWebassemblyHeaderValue header value for web assembly files.
|
||||||
|
ContentWebassemblyHeaderValue = "application/wasm"
|
||||||
// ContentHTMLHeaderValue is the string of text/html response header's content type value.
|
// ContentHTMLHeaderValue is the string of text/html response header's content type value.
|
||||||
ContentHTMLHeaderValue = "text/html"
|
ContentHTMLHeaderValue = "text/html"
|
||||||
// ContentJSONHeaderValue header value for JSON data.
|
// ContentJSONHeaderValue header value for JSON data.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user