mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:26:26 +01:00
don't force-set content type on gzip response writer's WriteString and Writef if already there
Former-commit-id: c882a6ef14e89dd0da7a3a2afc85100ca07dc869
This commit is contained in:
parent
e523d08cb1
commit
431e339ccc
2
Gopkg.lock
generated
2
Gopkg.lock
generated
|
@ -170,7 +170,7 @@
|
|||
revision = "abc90934186a77966e2beeac62ed966aac0561d5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
branch = "v1.2.0"
|
||||
name = "github.com/satori/go.uuid"
|
||||
packages = ["."]
|
||||
revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3"
|
||||
|
|
|
@ -117,7 +117,9 @@ func (w *GzipResponseWriter) Write(contents []byte) (int, error) {
|
|||
func (w *GzipResponseWriter) Writef(format string, a ...interface{}) (n int, err error) {
|
||||
n, err = fmt.Fprintf(w, format, a...)
|
||||
if err == nil {
|
||||
w.ResponseWriter.Header().Set(contentTypeHeaderKey, ContentTextHeaderValue)
|
||||
if w.ResponseWriter.Header()[contentTypeHeaderKey] == nil {
|
||||
w.ResponseWriter.Header().Set(contentTypeHeaderKey, ContentTextHeaderValue)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -128,7 +130,10 @@ func (w *GzipResponseWriter) Writef(format string, a ...interface{}) (n int, err
|
|||
func (w *GzipResponseWriter) WriteString(s string) (n int, err error) {
|
||||
n, err = w.Write([]byte(s))
|
||||
if err == nil {
|
||||
w.ResponseWriter.Header().Set(contentTypeHeaderKey, ContentTextHeaderValue)
|
||||
if w.ResponseWriter.Header()[contentTypeHeaderKey] == nil {
|
||||
w.ResponseWriter.Header().Set(contentTypeHeaderKey, ContentTextHeaderValue)
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user