-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathhttp_client.ex
29 lines (24 loc) · 999 Bytes
/
http_client.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
defmodule AWS.HTTPClient do
@moduledoc """
Specifies the behaviour of a HTTP Client.
You can switch the default HTTP client which uses hackney underneath
by defining a different implementation by setting the `:http_client`
configuration in `AWS.Client`:
client = %AWS.Client{http_client: {MyHttpClient, []}}
AWS.SNS.publish(client, "My message")
"""
@doc """
Executes a HTTP request. Either returns {:ok, map} or {:error, reason}.
- `body` is already parsed into iodata. It may be in either JSON or XML format.
- `headers` already contains required headers such as Authorization. See AWS.Request.sign_v4 for more details.
"""
@callback request(
method :: atom(),
url :: binary(),
body :: iodata(),
headers :: list(),
options :: keyword()
) ::
{:ok, %{status_code: integer(), headers: [{binary(), binary()}], body: binary()}}
| {:error, term()}
end