Skip to content
Snippets Groups Projects
Commit 4bac25e6 authored by href's avatar href
Browse files

Don't enable Pleroma.HTTP.Middleware.FollowRedirects unless Gun is used

parent 10d46235
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,8 @@ def request(method, url, body, headers, options) when is_binary(url) do
request = build_request(method, headers, options, url, body, params)
adapter = Application.get_env(:tesla, :adapter)
client = Tesla.client([Pleroma.HTTP.Middleware.FollowRedirects], adapter)
client = Tesla.client(adapter_middlewares(adapter), adapter)
maybe_limit(
fn ->
......@@ -107,4 +108,10 @@ defp maybe_limit(fun, Tesla.Adapter.Gun, opts) do
defp maybe_limit(fun, _, _) do
fun.()
end
defp adapter_middlewares(Tesla.Adapter.Gun) do
[Pleroma.HTTP.Middleware.FollowRedirects]
end
defp adapter_middlewares(_), do: []
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment