diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-03-03 14:56:49 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-03-03 14:56:49 +0300 |
commit | d0e4d3ca3b9d8b8ed00d58e9e1c2a05ab561326c (patch) | |
tree | b26ea2ebceb98e27ef322f76ea2f47927ea7b6f2 /lib/pleroma/reverse_proxy | |
parent | 24d1ac125c6ae719b3d119f2ec0079dcd74eadc2 (diff) | |
download | pleroma-d0e4d3ca3b9d8b8ed00d58e9e1c2a05ab561326c.tar.gz |
removing unnecessary with
comment in tesla client impovement
Diffstat (limited to 'lib/pleroma/reverse_proxy')
-rw-r--r-- | lib/pleroma/reverse_proxy/client/tesla.ex | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/pleroma/reverse_proxy/client/tesla.ex b/lib/pleroma/reverse_proxy/client/tesla.ex index 498a905e1..80a0c8972 100644 --- a/lib/pleroma/reverse_proxy/client/tesla.ex +++ b/lib/pleroma/reverse_proxy/client/tesla.ex @@ -18,8 +18,9 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do def request(method, url, headers, body, opts \\ []) do check_adapter() - with opts <- Keyword.merge(opts, body_as: :chunks, mode: :passive), - {:ok, response} <- + opts = Keyword.merge(opts, body_as: :chunks) + + with {:ok, response} <- Pleroma.HTTP.request( method, url, @@ -40,7 +41,8 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do @impl true @spec stream_body(map()) :: {:ok, binary(), map()} | {:error, atom() | String.t()} | :done def stream_body(%{pid: pid, opts: opts, fin: true}) do - # if connection was sended and there were redirects, we need to close new conn - pid manually + # if connection was reused, but in tesla were redirects, + # tesla returns new opened connection, which must be closed manually if opts[:old_conn], do: Tesla.Adapter.Gun.close(pid) # if there were redirects we need to checkout old conn conn = opts[:old_conn] || opts[:conn] |