media_proxy_url = MediaProxy.url(url)
with {:ok, %{status: status} = head_response} when status in 200..299 <-
- Pleroma.HTTP.request("head", media_proxy_url, [], [], name: MyFinch) do
+ Pleroma.HTTP.request("HEAD", media_proxy_url, [], [], name: MyFinch) do
content_type = Tesla.get_header(head_response, "content-type")
content_length = Tesla.get_header(head_response, "content-length")
content_length = content_length && String.to_integer(content_length)
media_proxy_url: media_proxy_url
} do
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 500, body: ""}
end)
media_proxy_url: media_proxy_url
} do
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 200, body: "", headers: [{"content-type", "application/pdf"}]}
end)
clear_config([:media_preview_proxy, :min_content_length], 1_000_000_000)
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{
status: 200,
body: "",
media_proxy_url: media_proxy_url
} do
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/gif"}]}
end)
media_proxy_url: media_proxy_url
} do
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/jpeg"}]}
end)
clear_config([:media_preview_proxy, :min_content_length], 100_000)
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{
status: 200,
body: "",
assert_dependencies_installed()
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/png"}]}
%{method: :get, url: ^media_proxy_url} ->
assert_dependencies_installed()
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/jpeg"}]}
%{method: :get, url: ^media_proxy_url} ->
media_proxy_url: media_proxy_url
} do
Tesla.Mock.mock(fn
- %{method: "head", url: ^media_proxy_url} ->
+ %{method: "HEAD", url: ^media_proxy_url} ->
%Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/jpeg"}]}
%{method: :get, url: ^media_proxy_url} ->