move to 2.5.5
[anni] / lib / pleroma / http / tzdata.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.HTTP.Tzdata do
6   @moduledoc false
7
8   @behaviour Tzdata.HTTPClient
9
10   alias Pleroma.HTTP
11
12   @impl true
13   def get(url, headers, options) do
14     options = Keyword.put_new(options, :pool, :default)
15
16     with {:ok, %Tesla.Env{} = env} <- HTTP.get(url, headers, options) do
17       {:ok, {env.status, env.headers, env.body}}
18     end
19   end
20
21   @impl true
22   def head(url, headers, options) do
23     options = Keyword.put_new(options, :pool, :default)
24
25     with {:ok, %Tesla.Env{} = env} <- HTTP.head(url, headers, options) do
26       {:ok, {env.status, env.headers}}
27     end
28   end
29 end