aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2016-04-05 12:21:24 +0000
committerFelix Hanley <felix@userspace.com.au>2016-04-05 12:21:24 +0000
commit7da4815b9fe209a54bb3a0db2456970e6bde9d75 (patch)
tree46fc6a1d931bfa2d6fea5fe9b78f1cb33b0cd30f
parentcbad86e777b4f0256a2e521c2ac52a9cf2340c8f (diff)
parent16f32db977c735c27289d98f2ef121025a2f1f72 (diff)
downloadgo-dict2rest-7da4815b9fe209a54bb3a0db2456970e6bde9d75.tar.gz
go-dict2rest-7da4815b9fe209a54bb3a0db2456970e6bde9d75.tar.bz2
Merge branch 'pmundt-trivial-fixes'
-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)