From: href Date: Sat, 18 Jul 2020 11:17:38 +0000 (+0200) Subject: Don't enable Pleroma.HTTP.Middleware.FollowRedirects unless Gun is used X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4bac25e6f5d332b06e481d25b80efb62026c6a1e;p=akkoma Don't enable Pleroma.HTTP.Middleware.FollowRedirects unless Gun is used --- 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