diff --git a/backend/src/uxbox/config.clj b/backend/src/uxbox/config.clj index 181b9a817..9d2d64616 100644 --- a/backend/src/uxbox/config.clj +++ b/backend/src/uxbox/config.clj @@ -31,6 +31,7 @@ :smtp-enabled false :allow-demo-users true :registration-enabled true + :debug-humanize-transit true }) (s/def ::http-server-port ::us/integer) diff --git a/backend/src/uxbox/http/interceptors.clj b/backend/src/uxbox/http/interceptors.clj index eff7fb232..742606d2a 100644 --- a/backend/src/uxbox/http/interceptors.clj +++ b/backend/src/uxbox/http/interceptors.clj @@ -2,11 +2,15 @@ ;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; -;; Copyright (c) 2019 Andrey Antukh +;; This Source Code Form is "Incompatible With Secondary Licenses", as +;; defined by the Mozilla Public License, v. 2.0. +;; +;; Copyright (c) 2019-2020 Andrey Antukh (ns uxbox.http.interceptors (:require [vertx.web :as vw] + [uxbox.config :as cfg] [uxbox.common.exceptions :as ex] [uxbox.util.transit :as t]) (:import @@ -30,12 +34,15 @@ (def format-response-body {:leave (fn [{:keys [response] :as data}] - (let [body (:body response)] + (let [body (:body response) + type (if (:debug-humanize-transit cfg/config) + :json-verbose + :json)] (cond (coll? body) (-> data (assoc-in [:response :body] - (t/bytes->buffer (t/encode body))) + (t/bytes->buffer (t/encode body {:type type}))) (update-in [:response :headers] assoc "content-type" "application/transit+json"))