debianize-mobilizon/lib/service/http/base_client.ex
Thomas Citharel 9c9f1385fb
Introduce group posts
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-07-30 16:55:35 +02:00

31 lines
527 B
Elixir

defmodule Mobilizon.Service.HTTP.BaseClient do
@moduledoc """
Tesla HTTP Basic Client
"""
use Tesla
alias Mobilizon.Config
@default_opts [
recv_timeout: 20_000
]
adapter(Tesla.Adapter.Hackney, @default_opts)
@user_agent Config.instance_user_agent()
plug(Tesla.Middleware.FollowRedirects)
plug(Tesla.Middleware.Timeout, timeout: 10_000)
plug(Tesla.Middleware.Headers, [{"User-Agent", @user_agent}])
def get(url) do
get(url)
end
def post(url, data) do
post(url, data)
end
end