       (downstream :body (ChannelBuffers/wrappedBuffer (mk-trailer deflater crc)))
       (downstream :body nil))))
 
-(def default-opts {:gzip-content-types #{"text/html"
-                                         "text/javascript"}})
+(def default-opts {:gzip-content-types #{"text/plain"
+                                         "text/html"
+                                         "text/xhtml"
+                                         "text/javascript"
+                                         "application/javascript"
+                                         "text/css"}})
 
 (defn encoder
   ([app] (encoder app default-opts))


(defn- gzip-entire-body
  [deflater crc body]
  (println "GZIPPING ENTIRE BODY")
  (let [baos (ByteArrayOutputStream.)
        buf (byte-array 4092)
        bytes (body->byte-array body)]

          (do
            (.write baos (mk-trailer deflater crc))
            (.close baos)
            (ChannelBuffers/copiedBuffer (.toByteArray baos))))))))

(defn- send-chunks
  [deflater downstream buf]
  (let [buf-len (alength buf)]
    (loop []
      (let [compressed-bytes (.deflate deflater buf 0 buf-len)]
        (if-not (= 0 compressed-bytes)
          (let [channel-buffer (ChannelBuffers/copiedBuffer buf 0 compressed-bytes)]
            (downstream :body channel-buffer)
            (recur)))))))

