Use Jason for rendering responses
authorrinpatch <rinpatch@sdf.org>
Wed, 11 Sep 2019 20:04:01 +0000 (23:04 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 11 Sep 2019 20:06:31 +0000 (23:06 +0300)
Although Jason readme says Phoenix 1.4+ already does it by default, [it actually does it only for new projects](https://github.com/phoenixframework/phoenix/blob/3bfb9f6e900c9a2e31cb95736e2cb5bdad329b61/lib/phoenix.ex#L58-L59)

config/config.exs
lib/pleroma/healthcheck.ex [moved from lib/healthcheck.ex with 98% similarity]

index 5206fe3759c26e43e7a5537746ac5665002e97e7..0e91df88660a83e3a40ab91bc6dc12ff321b8a24 100644 (file)
@@ -373,6 +373,8 @@ config :pleroma, :chat, enabled: true
 
 config :phoenix, :format_encoders, json: Jason
 
+config :phoenix, :json_library, Jason
+
 config :pleroma, :gopher,
   enabled: false,
   ip: {0, 0, 0, 0},
similarity index 98%
rename from lib/healthcheck.ex
rename to lib/pleroma/healthcheck.ex
index f97d14432b27d1858e0df990d71b22b5b10b0519..977b78c268d8ab59f2af297069a6eb44966725bc 100644 (file)
@@ -9,6 +9,7 @@ defmodule Pleroma.Healthcheck do
   alias Pleroma.Healthcheck
   alias Pleroma.Repo
 
+  @derive Jason.Encoder
   defstruct pool_size: 0,
             active: 0,
             idle: 0,