From 4837ad0f74c00c862e42b502e1c6e839e86dd95f Mon Sep 17 00:00:00 2001 From: Andy Tran Date: Sat, 23 Sep 2023 21:43:45 -0400 Subject: [PATCH 1/2] Improve docs --- lib/ex_aws/request/http_client.ex | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/ex_aws/request/http_client.ex b/lib/ex_aws/request/http_client.ex index c6cda214..392f8667 100644 --- a/lib/ex_aws/request/http_client.ex +++ b/lib/ex_aws/request/http_client.ex @@ -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 config: + + ``` + config :ex_aws, + http_client: ExAws.Request.Req ``` When conforming your selected HTTP Client take note of a few things: From 35fb0ba525b1d680abeadd846434332c71adeb4c Mon Sep 17 00:00:00 2001 From: Andy Tran Date: Sat, 23 Sep 2023 23:10:55 -0400 Subject: [PATCH 2/2] Clarify build-time config --- lib/ex_aws/request/http_client.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ex_aws/request/http_client.ex b/lib/ex_aws/request/http_client.ex index 392f8667..ca19cafb 100644 --- a/lib/ex_aws/request/http_client.ex +++ b/lib/ex_aws/request/http_client.ex @@ -22,7 +22,7 @@ defmodule ExAws.Request.HttpClient do end ``` - Then, in config: + Then, in build-time config (e.g. config.exs): ``` config :ex_aws,