Skip to content

Commit

Permalink
Support x-amz-expires
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed May 27, 2024
1 parent de68a00 commit cb4df2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/req/steps.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,10 @@ defmodule Req.Steps do
:service,
:region,
:datetime,
:into
:into,

# for req_s3
:expires
])

{into, aws_options} = Keyword.pop(aws_options, :into, :headers)
Expand Down
3 changes: 2 additions & 1 deletion lib/req/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ defmodule Req.Utils do
{datetime, options} = Keyword.pop!(options, :datetime)
{method, options} = Keyword.pop!(options, :method)
{url, options} = Keyword.pop!(options, :url)
{expires, options} = Keyword.pop(options, :expires, 86400)
[] = options

datetime = DateTime.truncate(datetime, :second)
Expand All @@ -104,7 +105,7 @@ defmodule Req.Utils do
{"X-Amz-Algorithm", "AWS4-HMAC-SHA256"},
{"X-Amz-Credential", "#{access_key_id}/#{date_string}/#{region}/#{service}/aws4_request"},
{"X-Amz-Date", datetime_string},
{"X-Amz-Expires", 86400},
{"X-Amz-Expires", expires},
{"X-Amz-SignedHeaders", "host"}
])

Expand Down

0 comments on commit cb4df2c

Please sign in to comment.