Honor Accept-Encoding header in gzip transcoder

This avoids sending compressed data to clients which do not support
it.
This commit is contained in:
Andrew Gaul
2017-01-14 15:20:14 -08:00
parent cac3b84a5d
commit 11a40b5051
7 changed files with 28 additions and 12 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/tdewolff/minify/css"
"github.com/tdewolff/minify/html"
"github.com/tdewolff/minify/js"
"net/http"
)
type Minifier struct {
@ -24,6 +25,6 @@ func NewMinifier() *Minifier {
}
}
func (t *Minifier) Transcode(w *proxy.ResponseWriter, r *proxy.ResponseReader) error {
func (t *Minifier) Transcode(w *proxy.ResponseWriter, r *proxy.ResponseReader, headers http.Header) error {
return t.m.Minify(r.ContentType(), w, r)
}