Skip to content

Commit 0b1c100

Browse files
brentjandersonbernardd
authored andcommitted
fix: req support for pod identity
The current pod identity implementation provides defaults that are merged into other http options. The Pod identity request defaults include :recv_timeout which is incompatible with Req. By following #1095 we can unblock Req adapter users on pod identity implementation. A more robust fix that would also be a breaking change would involve getting the default HTTP options from the adapter itself for various use-cases, and merging those into the implementation.
1 parent 81e353f commit 0b1c100

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
v2.7.0 (2026-03-04)
22
- Upgrade hackney to 3.x
3+
- Correctly handle pod identity authorization when using Req adapter
34

45
v2.6.1 (2025-12-09)
56
- Endpoint updates

lib/ex_aws/request/req.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if Code.ensure_loaded?(Req) do
1717

1818
@impl true
1919
def request(method, url, body \\ "", headers \\ [], http_opts \\ []) do
20-
http_opts = rename_follow_redirect(http_opts)
20+
http_opts = http_opts |> rename_follow_redirect() |> rename_recv_timeout()
2121

2222
[method: method, url: url, body: body, headers: headers, decode_body: false, retry: false]
2323
|> Keyword.merge(Application.get_env(:ex_aws, :req_opts, @default_opts))
@@ -39,5 +39,12 @@ if Code.ensure_loaded?(Req) do
3939

4040
Keyword.put(opts, :redirect, follow)
4141
end
42+
43+
# Rename :recv_timeout to :receive_timeout for Req to use.
44+
defp rename_recv_timeout(opts) do
45+
{recv_timeout, opts} = Keyword.pop(opts, :recv_timeout, 30_000)
46+
47+
Keyword.put(opts, :receive_timeout, recv_timeout)
48+
end
4249
end
4350
end

0 commit comments

Comments
 (0)