2020-06-25 04:12:29 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-13 06:49:20 +00:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2020-06-25 04:12:29 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.HTTP.ExAws do
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
@behaviour ExAws.Request.HttpClient
|
|
|
|
|
|
|
|
alias Pleroma.HTTP
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
def request(method, url, body \\ "", headers \\ [], http_opts \\ []) do
|
2020-09-07 13:57:42 +00:00
|
|
|
http_opts = Keyword.put_new(http_opts, :pool, :upload)
|
2020-08-19 07:22:59 +00:00
|
|
|
|
2020-06-25 04:12:29 +00:00
|
|
|
case HTTP.request(method, url, body, headers, http_opts) do
|
|
|
|
{:ok, env} ->
|
|
|
|
{:ok, %{status_code: env.status, headers: env.headers, body: env.body}}
|
|
|
|
|
|
|
|
{:error, reason} ->
|
|
|
|
{:error, %{reason: reason}}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|