diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2018-12-01 08:26:59 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2018-12-04 14:03:32 +0300 |
commit | 3ce16e5a56be01686a03f40931f666ac164df6e8 (patch) | |
tree | c5db9f5efa5303409100bdf60f5f9049ec29644a /lib/pleroma/http/connection.ex | |
parent | 88b05aeabb23412530f6b74934bc3d2d3fe8c29f (diff) | |
download | pleroma-3ce16e5a56be01686a03f40931f666ac164df6e8.tar.gz |
init tesla and updated the http requests in Pleroma.Web.Websub
Diffstat (limited to 'lib/pleroma/http/connection.ex')
-rw-r--r-- | lib/pleroma/http/connection.ex | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/pleroma/http/connection.ex b/lib/pleroma/http/connection.ex new file mode 100644 index 000000000..12667b663 --- /dev/null +++ b/lib/pleroma/http/connection.ex @@ -0,0 +1,22 @@ +defmodule Pleroma.HTTP.Connection do + @hackney_options [pool: :default] + + @doc """ + Configure a client connection + + # Returns + + Tesla.Env.client + """ + @spec new(Keyword.t()) :: Tesla.Env.client() + def new(opts \\ []) do + Tesla.client([], {Tesla.Adapter.Hackney, hackney_options(opts)}) + end + + # fetch Hackney options + # + defp hackney_options(opts \\ []) do + options = Keyword.get(opts, :adapter, []) + @hackney_options ++ options + end +end |