From e7c02a3c38fa3dc3eede0073db2393d5c1306f6a Mon Sep 17 00:00:00 2001 From: Cam Saul <cam@getluckybird.com> Date: Thu, 12 Mar 2015 17:44:00 -0700 Subject: [PATCH] Add Ring GZIP middleware. MAKES THINGS FASTER EVEN RUNNING LOCALLY <3 --- project.clj | 1 + src/metabase/core.clj | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 15718ac43ac..932e6bd18c5 100644 --- a/project.clj +++ b/project.clj @@ -16,6 +16,7 @@ [org.clojure/tools.logging "0.3.1"] ; logging framework [org.clojure/tools.macro "0.1.5"] ; tools for writing macros [org.clojure/tools.trace "0.7.8"] ; "tracing macros/fns to help you see what your code is doing" + [amalloy/ring-gzip-middleware "0.1.3"] ; Ring middleware to GZIP responses if client can handle it [cheshire "5.4.0"] ; fast JSON encoding (used by Ring JSON middleware) [clj-http-lite "0.2.1"] ; HTTP client; lightweight version of clj-http that uses HttpURLConnection instead of Apache [clj-time "0.9.0"] ; library for dealing with date/time diff --git a/src/metabase/core.clj b/src/metabase/core.clj index b9cf691d300..d1bd2da87d6 100644 --- a/src/metabase/core.clj +++ b/src/metabase/core.clj @@ -12,6 +12,7 @@ [metabase.util :as util] [ring.adapter.jetty :as ring-jetty] (ring.middleware [cookies :refer [wrap-cookies]] + [gzip :refer [wrap-gzip]] [json :refer [wrap-json-response wrap-json-body]] [keyword-params :refer [wrap-keyword-params]] @@ -32,7 +33,7 @@ auth/wrap-sessionid ; looks for a Metabase sessionid and assocs as :metabase-sessionid wrap-cookies ; Parses cookies in the request map and assocs as :cookies wrap-session ; reads in current HTTP session and sets :session/key - )) + wrap-gzip)) ; GZIP response if client can handle it (defn init -- GitLab