mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-01-02 21:38:41 +00:00
Merge branch 'mediav2-fix' into 'develop'
Fix /api/v2/media returning the wrong status code for media processed synchronously See merge request pleroma/pleroma!4291
This commit is contained in:
commit
6099a94dbc
4 changed files with 5 additions and 6 deletions
1
changelog.d/mediav2_status.fix
Normal file
1
changelog.d/mediav2_status.fix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix /api/v2/media returning the wrong status code (202) for media processed synchronously
|
|
@ -121,7 +121,7 @@ defmodule Pleroma.Web.ApiSpec.MediaOperation do
|
||||||
security: [%{"oAuth" => ["write:media"]}],
|
security: [%{"oAuth" => ["write:media"]}],
|
||||||
requestBody: Helpers.request_body("Parameters", create_request()),
|
requestBody: Helpers.request_body("Parameters", create_request()),
|
||||||
responses: %{
|
responses: %{
|
||||||
202 => Operation.response("Media", "application/json", Attachment),
|
200 => Operation.response("Media", "application/json", Attachment),
|
||||||
400 => Operation.response("Media", "application/json", ApiError),
|
400 => Operation.response("Media", "application/json", ApiError),
|
||||||
422 => Operation.response("Media", "application/json", ApiError),
|
422 => Operation.response("Media", "application/json", ApiError),
|
||||||
500 => Operation.response("Media", "application/json", ApiError)
|
500 => Operation.response("Media", "application/json", ApiError)
|
||||||
|
|
|
@ -53,9 +53,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaController do
|
||||||
) do
|
) do
|
||||||
attachment_data = Map.put(object.data, "id", object.id)
|
attachment_data = Map.put(object.data, "id", object.id)
|
||||||
|
|
||||||
conn
|
render(conn, "attachment.json", %{attachment: attachment_data})
|
||||||
|> put_status(202)
|
|
||||||
|> render("attachment.json", %{attachment: attachment_data})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/v2/media", %{"file" => image, "description" => desc})
|
|> 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"]
|
assert media_id = response["id"]
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
|
||||||
"file" => large_binary,
|
"file" => large_binary,
|
||||||
"description" => desc
|
"description" => desc
|
||||||
})
|
})
|
||||||
|> json_response_and_validate_schema(202)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert media_id = response["id"]
|
assert media_id = response["id"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue