all tests passed
[akkoma] / lib / pleroma / http / connection.ex
1 defmodule Pleroma.HTTP.Connection do
2 @hackney_options [pool: :default]
3 @adapter Application.get_env(:tesla, :adapter)
4
5 @doc """
6 Configure a client connection
7
8 # Returns
9
10 Tesla.Env.client
11 """
12 @spec new(Keyword.t()) :: Tesla.Env.client()
13 def new(opts \\ []) do
14 Tesla.client([], {@adapter, hackney_options(opts)})
15 end
16
17 # fetch Hackney options
18 #
19 defp hackney_options(opts \\ []) do
20 options = Keyword.get(opts, :adapter, [])
21 @hackney_options ++ options
22 end
23 end