X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcontroller_helper.ex;h=6445966e020c09b6e363599afb66baf2e2f51d53;hb=5c4ff5c73ce41f252e99a3c5c445efcecaa43dfe;hp=69946fb81ee6a5571728586e8c8fbde681ccb351;hpb=4ec2fb967e0eb0559e39a6d698107f6af4d7a891;p=akkoma diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex index 69946fb81..6445966e0 100644 --- a/lib/pleroma/web/controller_helper.ex +++ b/lib/pleroma/web/controller_helper.ex @@ -18,6 +18,12 @@ defmodule Pleroma.Web.ControllerHelper do def truthy_param?(value), do: not falsy_param?(value) + def json_response(conn, status, _) when status in [204, :no_content] do + conn + |> put_resp_header("content-type", "application/json") + |> send_resp(status, "") + end + def json_response(conn, status, json) do conn |> put_status(status)