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