diff options
author | Alex S <alex.strizhakov@gmail.com> | 2019-08-08 18:42:50 +0300 |
---|---|---|
committer | Alex S <alex.strizhakov@gmail.com> | 2019-08-20 12:39:53 +0300 |
commit | 4e9d9209c3c598532e1eaacb35e276357906afb4 (patch) | |
tree | 2aaa94ca4f84bb874d3e0eb974dd791f18a5d557 /lib/pleroma/reverse_proxy/client/hackney.ex | |
parent | b383d85b9b8229751dd538c66e02a18f2de45835 (diff) | |
download | pleroma-4e9d9209c3c598532e1eaacb35e276357906afb4.tar.gz |
added tesla client for reverse proxy
Diffstat (limited to 'lib/pleroma/reverse_proxy/client/hackney.ex')
-rw-r--r-- | lib/pleroma/reverse_proxy/client/hackney.ex | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pleroma/reverse_proxy/client/hackney.ex b/lib/pleroma/reverse_proxy/client/hackney.ex new file mode 100644 index 000000000..e6293646a --- /dev/null +++ b/lib/pleroma/reverse_proxy/client/hackney.ex @@ -0,0 +1,17 @@ +defmodule Pleroma.ReverseProxy.Client.Hackney do + @behaviour Pleroma.ReverseProxy.Client + + def request(method, url, headers, body, opts \\ []) do + :hackney.request(method, url, headers, body, opts) + end + + def stream_body(ref) do + case :hackney.stream_body(ref) do + :done -> :done + {:ok, data} -> {:ok, data, ref} + {:error, error} -> {:error, error} + end + end + + def close(ref), do: :hackney.close(ref) +end |