aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dict2rest/gzip.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dict2rest/gzip.go b/src/dict2rest/gzip.go
index 15f550f..d2264e2 100644
--- a/src/dict2rest/gzip.go
+++ b/src/dict2rest/gzip.go
@@ -20,7 +20,9 @@ func (w gzipResponseWriter) Write(b []byte) (int, error) {
func Gzip(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
if !strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") {
+ // If gzip is unsupported, revert to standard handler.
next.ServeHTTP(w, req)
+ return
}
w.Header().Set("Content-Encoding", "gzip")
gz := gzip.NewWriter(w)