Merge remote-tracking branch 'origin' into follower-hiding
[akkoma] / lib / pleroma / http / connection.ex
1 defmodule Pleroma.HTTP.Connection do
2 @moduledoc """
3 Connection for http-requests.
4 """
5
6 @hackney_options [pool: :default]
7 @adapter Application.get_env(:tesla, :adapter)
8
9 @doc """
10 Configure a client connection
11
12 # Returns
13
14 Tesla.Env.client
15 """
16 @spec new(Keyword.t()) :: Tesla.Env.client()
17 def new(opts \\ []) do
18 Tesla.client([], {@adapter, hackney_options(opts)})
19 end
20
21 # fetch Hackney options
22 #
23 defp hackney_options(opts \\ []) do
24 options = Keyword.get(opts, :adapter, [])
25 @hackney_options ++ options
26 end
27 end