ReverseProxy Tesla: Explicitly reformat proxy
This commit is contained in:
parent
d090aeb2bb
commit
ce4e1d4287
1 changed files with 8 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
|
|||
@behaviour Pleroma.ReverseProxy.Client
|
||||
|
||||
alias Pleroma.Gun.ConnectionPool
|
||||
alias Pleroma.HTTP.AdapterHelper
|
||||
|
||||
@type headers() :: [{String.t(), String.t()}]
|
||||
@type status() :: pos_integer()
|
||||
|
|
@ -20,6 +21,13 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
|
|||
def request(method, url, headers, body, opts \\ []) do
|
||||
check_adapter()
|
||||
|
||||
# MediaProxyController inserts MediaProxy proxy configuration into the ReverseProxy call.
|
||||
# This config can be unformatted and in String representation, while this works for Hackney,
|
||||
# it does not work for Tesla and the proxy needs to be reformatted.
|
||||
# Gun AdapterHelper doesn't do it, since it does not overwrite proxy config.
|
||||
proxy = AdapterHelper.format_proxy(opts[:proxy])
|
||||
opts = if proxy, do: Keyword.put(opts, :proxy, proxy), else: opts
|
||||
|
||||
opts = Keyword.put(opts, :body_as, :chunks)
|
||||
|
||||
with {:ok, response} <-
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue