mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00: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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user