Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs regarding Req #995

Merged
merged 2 commits into from Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 14 additions & 11 deletions lib/ex_aws/request/http_client.ex
Expand Up @@ -9,21 +9,24 @@ defmodule ExAws.Request.HttpClient do

## Example

Here for example is the code required to make HTTPotion comply with this spec.
Here is an example using [Req](https://hexdocs.pm/req/readme.html).

In your config you would do:
First, create a module implementing the `ExAws.Request.HttpClient` behaviour.

```
config :ex_aws,
http_client: ExAws.Request.Req

defmodule ExAws.Request.Req do
@behaviour ExAws.Request.HttpClient
def request(method, url, body, headers, _http_opts) do
Req.request(method: method, url: url, body: body, headers: headers)
end
end
defmodule ExAws.Request.Req do
@behaviour ExAws.Request.HttpClient
def request(method, url, body, headers, _http_opts) do
Req.request(method: method, url: url, body: body, headers: headers)
end
end
```

Then, in build-time config (e.g. config.exs):

```
config :ex_aws,
http_client: ExAws.Request.Req
```

When conforming your selected HTTP Client take note of a few things:
Expand Down