diff options
author | lain <lain@soykaf.club> | 2020-08-11 09:18:56 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-11 09:18:56 +0000 |
commit | 686002164a5ab63ccb22cff015faf87f8f7fc9ec (patch) | |
tree | f4651ce327e6113577733dd31d13a07f0b18d252 /lib | |
parent | 78484fe0ef48079d3ca811c475b109a3306b3e5c (diff) | |
parent | 9a9121805ceccfa62c77e9abc81af5f7c7fd4049 (diff) | |
download | pleroma-686002164a5ab63ccb22cff015faf87f8f7fc9ec.tar.gz pleroma-686002164a5ab63ccb22cff015faf87f8f7fc9ec.zip |
Merge branch '204-fix' into 'develop'
Fix 500 errors when returning :no_content, fixes #2029
Closes #2029
See merge request pleroma/pleroma!2856
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/controller_helper.ex | 6 |
1 files changed, 6 insertions, 0 deletions
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) |