diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2018-12-04 17:51:49 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2018-12-04 18:09:22 +0300 |
commit | 50e72f6c4851d50b27f213b34b5d383b9e8aabb9 (patch) | |
tree | 16c60463543ebecbd458c8c78d4b79cc1ec6b1e6 /lib | |
parent | dd8aee332cf939f1a76f60a95b117ab90530178b (diff) | |
download | pleroma-50e72f6c4851d50b27f213b34b5d383b9e8aabb9.tar.gz |
remove httpoison_mock
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/http/http.ex | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/pleroma/http/http.ex b/lib/pleroma/http/http.ex index 4ab12ed3a..3c0256575 100644 --- a/lib/pleroma/http/http.ex +++ b/lib/pleroma/http/http.ex @@ -1,9 +1,24 @@ defmodule Pleroma.HTTP do + @moduledoc """ + + """ + alias Pleroma.HTTP.Connection alias Pleroma.HTTP.RequestBuilder, as: Builder @doc """ Builds and perform http request. + + # Arguments: + `method` - :get, :post, :put, :delete + `url` + `body` + `headers` - a keyworld list of headers, e.g. `[{"content-type", "text/plain"}]` + `options` - custom, per-request middleware or adapter options + + # Returns: + `{:ok, %Tesla.Env{}}` or `{:error, error}` + """ def request(method, url, body \\ "", headers \\ [], options \\ []) do options = @@ -43,9 +58,19 @@ defmodule Pleroma.HTTP do end end + @doc """ + Performs GET request. + + See `Pleroma.HTTP.request/5` + """ def get(url, headers \\ [], options \\ []), do: request(:get, url, "", headers, options) + @doc """ + Performs POST request. + + See `Pleroma.HTTP.request/5` + """ def post(url, body, headers \\ [], options \\ []), do: request(:post, url, body, headers, options) end |