Force 204 responses to be empty, fixes #2029

This commit is contained in:
Alex Gleason 2020-08-07 13:02:39 -05:00
commit 673e8e3ac1
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 19 additions and 6 deletions

View file

@ -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)