diff options
author | Mark Felder <feld@feld.me> | 2024-10-27 21:52:42 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-10-27 21:52:42 -0400 |
commit | 7d5ef8173735015c473fbc292a7f4b23d3e504a1 (patch) | |
tree | d3df021015cf7e0aa2706494553f1b3fe1be2ca2 /test | |
parent | 2d591aedaeda3d80e9c1b31c0c83eae954849f36 (diff) | |
download | pleroma-7d5ef8173735015c473fbc292a7f4b23d3e504a1.tar.gz pleroma-7d5ef8173735015c473fbc292a7f4b23d3e504a1.zip |
Fix /api/v2/media returning the wrong status code for media processed synchronously
The API should return a 202 only if data cannot be returned yet and a followup GET /api/v1/media/:id should be called to retrieve it. This is something Mastodon does when it needs to transcode large media files. It does not apply to Pleroma and causes apps to waste an API call when posting a status which causes apps to appear to hang on higher latency environments, such as on mobile networks.
https://docs.joinmastodon.org/methods/media/#v2
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/media_controller_test.exs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs index 4adbaa640..3f696d94d 100644 --- a/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs @@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do conn |> put_req_header("content-type", "multipart/form-data") |> post("/api/v2/media", %{"file" => image, "description" => desc}) - |> json_response_and_validate_schema(202) + |> json_response_and_validate_schema(200) assert media_id = response["id"] @@ -111,7 +111,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do "file" => large_binary, "description" => desc }) - |> json_response_and_validate_schema(202) + |> json_response_and_validate_schema(200) assert media_id = response["id"] |