Skip to content

Commit

Permalink
Merge pull request #1095 from eds314/rename-follow-redirect
Browse files Browse the repository at this point in the history
Rename follow redirect in Req adapter
  • Loading branch information
bernardd authored Oct 31, 2024
2 parents 736149f + e2ed4a9 commit 1841c4d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ex_aws/request/req.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ defmodule ExAws.Request.Req do

@impl true
def request(method, url, body \\ "", headers \\ [], http_opts \\ []) do
http_opts = rename_follow_redirect(http_opts)

[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)
Expand All @@ -28,4 +30,12 @@ defmodule ExAws.Request.Req do
{:error, %{reason: reason}}
end
end

# Req uses :follow_redirects, but some clients pass the :hackney option
# :follow_redirect. Rename the option for Req to use.
defp rename_follow_redirect(opts) do
{follow, opts} = Keyword.pop(opts, :follow_redirect, false)

Keyword.put(opts, :follow_redirects, follow)
end
end

0 comments on commit 1841c4d

Please sign in to comment.