1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.ReverseProxy.Client.Wrapper do
6 @moduledoc "Meta-client that calls the appropriate client from the config."
7 @behaviour Pleroma.ReverseProxy.Client
10 def request(method, url, headers, body \\ "", opts \\ []) do
11 client().request(method, url, headers, body, opts)
15 def stream_body(ref), do: client().stream_body(ref)
18 def close(ref), do: client().close(ref)
22 |> Application.get_env(:adapter)
26 defp client(Tesla.Adapter.Hackney), do: Pleroma.ReverseProxy.Client.Hackney
27 defp client(Tesla.Adapter.Gun), do: Pleroma.ReverseProxy.Client.Tesla
28 defp client({Tesla.Adapter.Finch, _}), do: Pleroma.ReverseProxy.Client.Hackney
29 defp client(_), do: Pleroma.Config.get!(Pleroma.ReverseProxy.Client)