Skip to content

Commit

Permalink
Rename follow redirect in Req adapter
Browse files Browse the repository at this point in the history
Closes #1087
  • Loading branch information
eds314 committed Oct 30, 2024
1 parent 40ecb2a commit e2ed4a9
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 e2ed4a9

Please sign in to comment.