Merge branch 'copyright-fun' into 'develop'
[akkoma] / lib / pleroma / http / ex_aws.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.HTTP.ExAws do
6 @moduledoc false
7
8 @behaviour ExAws.Request.HttpClient
9
10 alias Pleroma.HTTP
11
12 @impl true
13 def request(method, url, body \\ "", headers \\ [], http_opts \\ []) do
14 http_opts = Keyword.put_new(http_opts, :pool, :upload)
15
16 case HTTP.request(method, url, body, headers, http_opts) do
17 {:ok, env} ->
18 {:ok, %{status_code: env.status, headers: env.headers, body: env.body}}
19
20 {:error, reason} ->
21 {:error, %{reason: reason}}
22 end
23 end
24 end