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 /test/support | |
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 'test/support')
-rw-r--r-- | test/support/conn_case.ex | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index b23918dd1..7ef681258 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -56,6 +56,13 @@ defmodule Pleroma.Web.ConnCase do [conn: conn] end + defp empty_json_response(conn) do + body = response(conn, 204) + response_content_type(conn, :json) + + body + end + defp json_response_and_validate_schema( %{ private: %{ @@ -79,7 +86,7 @@ defmodule Pleroma.Web.ConnCase do end schema = lookup[op_id].responses[status].content[content_type].schema - json = json_response(conn, status) + json = if status == 204, do: empty_json_response(conn), else: json_response(conn, status) case OpenApiSpex.cast_value(json, schema, spec) do {:ok, _data} -> |