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