aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2020-07-18 16:49:30 +0000
committerfeld <feld@feld.me>2020-07-18 16:49:30 +0000
commitf0d13fc3f7d0e9b58cfe1cd8918072d45d656a31 (patch)
tree4ecea4f4b4d9ca3e66236ca90f9007fda7183e98 /lib
parent10d46235cfae03901c297473043a5700a8c5e4f0 (diff)
parent4bac25e6f5d332b06e481d25b80efb62026c6a1e (diff)
downloadpleroma-f0d13fc3f7d0e9b58cfe1cd8918072d45d656a31.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/http/http.ex9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/pleroma/http/http.ex b/lib/pleroma/http/http.ex
index 6128bc4cf..b37b3fa89 100644
--- a/lib/pleroma/http/http.ex
+++ b/lib/pleroma/http/http.ex
@@ -69,7 +69,8 @@ defmodule Pleroma.HTTP 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 @@ defmodule Pleroma.HTTP 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