added wrapper Pleroma.HTTP for ExAws.S3
[akkoma] / lib / pleroma / http / ex_aws.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 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 case HTTP.request(method, url, body, headers, http_opts) do
15 {:ok, env} ->
16 {:ok, %{status_code: env.status, headers: env.headers, body: env.body}}
17
18 {:error, reason} ->
19 {:error, %{reason: reason}}
20 end
21 end
22 end