From 6f2af48a5ac3beb22da29d8eb5908f6d53d26f0c Mon Sep 17 00:00:00 2001 From: Cam Saul <cammsaul@gmail.com> Date: Fri, 5 Apr 2019 19:31:22 -0700 Subject: [PATCH] Remove commented-out code :speaking_head_in_silhouette: --- src/metabase/middleware/json.clj | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/metabase/middleware/json.clj b/src/metabase/middleware/json.clj index 34b067d88eb..e032187c790 100644 --- a/src/metabase/middleware/json.clj +++ b/src/metabase/middleware/json.clj @@ -62,29 +62,6 @@ (respond ring.json/default-malformed-response)) (handler request respond raise)))) -#_(defn check-application-type-headers - "We don't support API requests with any type of content encoding other than JSON so let's be nice and make that - explicit. Added benefit is that it reduces CSRF surface because POSTing a form with JSON content encoding isn't so - easy to do." - [handler] - (fn - [{:keys [request-method body], {:strs [content-type]} :headers, :as request} respond raise] - ;; GET or DELETE requests with no body we can go ahead and proceed without Content-Type headers, since they - ;; generally don't have bodies. - ;; - ;; POST/PUT requests always require Content-Type: application/json. GET/DELETE requests that specify any other - ;; content type aren't allowed. - (if (or (and (#{:get :delete} request-method) - (nil? content-type)) - (#'ring.json/json-request? request)) - (handler request respond raise) - (respond - {:status 400 - :headers {"Content-Type" "text/plain"} - :body (str (tru "Metabase only supports JSON requests.") - " " - (tru "Make sure you set a 'Content-Type: application/json' header."))})))) - ;;; +----------------------------------------------------------------------------------------------------------------+ ;;; | Streaming JSON Responses | -- GitLab