1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.ReverseProxy.Client do
6 @callback request(atom(), String.t(), [tuple()], String.t(), list()) ::
7 {:ok, pos_integer(), [tuple()], reference() | map()}
8 | {:ok, pos_integer(), [tuple()]}
12 @callback stream_body(reference() | pid() | map()) ::
13 {:ok, binary()} | :done | {:error, String.t()}
15 @callback close(reference() | pid() | map()) :: :ok
17 def request(method, url, headers, "", opts \\ []) do
18 client().request(method, url, headers, "", opts)
21 def stream_body(ref), do: client().stream_body(ref)
23 def close(ref), do: client().close(ref)
26 Pleroma.Config.get([Pleroma.ReverseProxy.Client], :hackney)