- with uri <- URI.parse(url),
- received_adapter_opts <- Keyword.get(options, :adapter, []),
- adapter_opts <- Connection.options(uri, received_adapter_opts),
- options <- put_in(options[:adapter], adapter_opts),
- params <- Keyword.get(options, :params, []),
- request <- build_request(method, headers, options, url, body, params),
- client <- Tesla.client([Tesla.Middleware.FollowRedirects], tesla_adapter()),
- pid <- Process.whereis(adapter_opts[:pool]) do
- pool_alive? =
- if tesla_adapter() == Tesla.Adapter.Gun do
- if pid, do: Process.alive?(pid), else: false
- else
- false
- end
-
- request_opts =
- adapter_opts
- |> Enum.into(%{})
- |> Map.put(:env, Pleroma.Config.get([:env]))
- |> Map.put(:pool_alive?, pool_alive?)
-
- response =
- request(
- client,
- request,
- request_opts
- )