aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/http/ex_aws.ex
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-06-25 07:12:29 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-06-25 07:12:29 +0300
commit439a1a0218fe032ac35bb2e84516a8a4bf8563b4 (patch)
tree4b392eea811e2f5053bb5f44906441cc6ca41c26 /lib/pleroma/http/ex_aws.ex
parentae94fcc95f4ac105ed8c2b87dc36fbeea066866d (diff)
downloadpleroma-439a1a0218fe032ac35bb2e84516a8a4bf8563b4.tar.gz
added wrapper Pleroma.HTTP for ExAws.S3
Diffstat (limited to 'lib/pleroma/http/ex_aws.ex')
-rw-r--r--lib/pleroma/http/ex_aws.ex22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/pleroma/http/ex_aws.ex b/lib/pleroma/http/ex_aws.ex
new file mode 100644
index 000000000..e53e64077
--- /dev/null
+++ b/lib/pleroma/http/ex_aws.ex
@@ -0,0 +1,22 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# 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
+ 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