diff --git a/src/ring/middleware/gzip.clj b/src/ring/middleware/gzip.clj index 22eb983..74f9cda 100644 --- a/src/ring/middleware/gzip.clj +++ b/src/ring/middleware/gzip.clj @@ -14,8 +14,9 @@ (defn wrap-gzip [handler] (fn [req] (let [resp (handler req)] - (if (and (not ((resp :headers) "content-encoding")) - (string? (resp :body))) + (if (and (not ((get resp :headers {}) "content-encoding")) + (string? (resp :body)) + (> (count (resp :body)) 200)) (let [accepts (get (req :headers) "accept-encoding" "") match (re-find #"(gzip|\*)(;q=((0|1)(.\d+)?))?" accepts)] (if (and match (not (contains? #{"0" "0.0" "0.00" "0.000"}