X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Freverse_proxy%2Fclient.ex;h=75243d2dc5a3ddacb76ecaa5b977205b04dd27a9;hb=a17910a6c6dca88d98218bf9782b05b70b69446f;hp=26d14fabd7544ae03c5ff44fe87d5a74bb465de0;hpb=027714b519cca63ac943369d0bcc9534ba448a80;p=akkoma
diff --git a/lib/pleroma/reverse_proxy/client.ex b/lib/pleroma/reverse_proxy/client.ex
index 26d14fabd..75243d2dc 100644
--- a/lib/pleroma/reverse_proxy/client.ex
+++ b/lib/pleroma/reverse_proxy/client.ex
@@ -1,28 +1,20 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ReverseProxy.Client do
- @callback request(atom(), String.t(), [tuple()], String.t(), list()) ::
- {:ok, pos_integer(), [tuple()], reference() | map()}
- | {:ok, pos_integer(), [tuple()]}
+ @type status :: pos_integer()
+ @type header_name :: String.t()
+ @type header_value :: String.t()
+ @type headers :: [{header_name(), header_value()}]
+
+ @callback request(atom(), String.t(), headers(), String.t(), list()) ::
+ {:ok, status(), headers(), reference() | map()}
+ | {:ok, status(), headers()}
| {:ok, reference()}
| {:error, term()}
- @callback stream_body(reference() | pid() | map()) ::
- {:ok, binary()} | :done | {:error, String.t()}
+ @callback stream_body(map()) :: {:ok, binary(), map()} | :done | {:error, atom() | String.t()}
@callback close(reference() | pid() | map()) :: :ok
-
- def request(method, url, headers, "", opts \\ []) do
- client().request(method, url, headers, "", opts)
- end
-
- def stream_body(ref), do: client().stream_body(ref)
-
- def close(ref), do: client().close(ref)
-
- defp client do
- Pleroma.Config.get([Pleroma.ReverseProxy.Client], :hackney)
- end
end