1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-24 05:17:03 +00:00
This commit is contained in:
Gerasimos Maropoulos
2016-08-14 05:44:36 +03:00
parent 56bd511427
commit c6f5406c3b
7 changed files with 160 additions and 117 deletions

View File

@@ -201,8 +201,9 @@ func (t *templateEngineWrapper) execute(ctx *Context, filename string, binding i
ctx.SetContentType(contentHTML + "; charset=" + charset)
var out io.Writer
if gzipEnabled {
ctx.Response.Header.Add("Content-Encoding", "gzip")
if gzipEnabled && ctx.clientAllowsGzip() {
ctx.RequestCtx.Response.Header.Add(varyHeader, acceptEncodingHeader)
ctx.SetHeader(contentEncodingHeader, "gzip")
gzipWriter := ctx.framework.AcquireGzip(ctx.Response.BodyWriter())
defer ctx.framework.ReleaseGzip(gzipWriter)