mirror of
https://git.youjo.love/youjo/youjo-be.git
synced 2024-11-20 13:59:55 +01:00
Merge branch 'fix/followredirects-hackney' into 'develop'
Don't enable Pleroma.HTTP.Middleware.FollowRedirects unless Gun is used Closes #1966 and #1961 See merge request pleroma/pleroma!2778
This commit is contained in:
commit
f0d13fc3f7
1 changed files with 8 additions and 1 deletions
|
@ -69,7 +69,8 @@ defmodule Pleroma.HTTP do
|
||||||
request = build_request(method, headers, options, url, body, params)
|
request = build_request(method, headers, options, url, body, params)
|
||||||
|
|
||||||
adapter = Application.get_env(:tesla, :adapter)
|
adapter = Application.get_env(:tesla, :adapter)
|
||||||
client = Tesla.client([Pleroma.HTTP.Middleware.FollowRedirects], adapter)
|
|
||||||
|
client = Tesla.client(adapter_middlewares(adapter), adapter)
|
||||||
|
|
||||||
maybe_limit(
|
maybe_limit(
|
||||||
fn ->
|
fn ->
|
||||||
|
@ -107,4 +108,10 @@ defmodule Pleroma.HTTP do
|
||||||
defp maybe_limit(fun, _, _) do
|
defp maybe_limit(fun, _, _) do
|
||||||
fun.()
|
fun.()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp adapter_middlewares(Tesla.Adapter.Gun) do
|
||||||
|
[Pleroma.HTTP.Middleware.FollowRedirects]
|
||||||
|
end
|
||||||
|
|
||||||
|
defp adapter_middlewares(_), do: []
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue