-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/hex/req-0.5.6
- Loading branch information
Showing
6 changed files
with
167 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule ExAws.Request.Req do | ||
@behaviour ExAws.Request.HttpClient | ||
|
||
@moduledoc """ | ||
Configuration for `m:Req`. | ||
Options can be set for `m:Req` with the following config: | ||
config :ex_aws, :req_opts, | ||
receive_timeout: 30_000 | ||
The default config handles setting the above. | ||
""" | ||
|
||
@default_opts [receive_timeout: 30_000] | ||
|
||
@impl true | ||
def request(method, url, body \\ "", headers \\ [], http_opts \\ []) do | ||
[method: method, url: url, body: body, headers: headers, decode_body: false] | ||
|> Keyword.merge(Application.get_env(:ex_aws, :req_opts, @default_opts)) | ||
|> Keyword.merge(http_opts) | ||
|> Req.request() | ||
|> case do | ||
{:ok, %{status: status, headers: headers, body: body}} -> | ||
{:ok, %{status_code: status, headers: headers, body: body}} | ||
|
||
{:error, reason} -> | ||
{:error, %{reason: reason}} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.