Skip to content

Commit

Permalink
Fix correct hostname for global endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
onno-vos-dev committed May 20, 2024
1 parent 9a01213 commit 5741bb2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/aws/request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ defmodule AWS.Request do
endpoint: client.endpoint,
service: metadata.signing_name,
global?: metadata.global?,
hostname: metadata.hostname,
endpoint_prefix: metadata.endpoint_prefix,
account_id: :proplists.get_value("x-amz-account-id", headers, nil)
}
Expand All @@ -198,6 +199,9 @@ defmodule AWS.Request do
%{endpoint: endpoint_fun} when is_function(endpoint_fun, 1) ->
endpoint_fun.(build_options)

%{global?: true, hostname: hostname} when is_binary(hostname) ->
hostname

%{global?: true, endpoint: endpoint} ->
endpoint = resolve_endpoint_sufix(endpoint)

Expand Down
1 change: 1 addition & 0 deletions test/aws/protocol_tests/json_post_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule AWS.ProtocolTests.JSONPostTest do
credential_scope: nil,
endpoint_prefix: "foo",
global?: false,
hostname: nil,
protocol: "json",
service_id: "Foo",
signature_version: "v4",
Expand Down
1 change: 1 addition & 0 deletions test/aws/protocol_tests/query_post_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule AWS.ProtocolTests.QueryPostTest do
credential_scope: nil,
endpoint_prefix: "foo",
global?: false,
hostname: nil,
protocol: "query",
service_id: "Foo",
signature_version: "v4",
Expand Down
1 change: 1 addition & 0 deletions test/aws/protocol_tests/rest_json_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule AWS.ProtocolTests.RestJSONTest do
credential_scope: nil,
endpoint_prefix: "foo",
global?: false,
hostname: nil,
protocol: "rest-json",
service_id: "Foo",
signature_version: "v4",
Expand Down
1 change: 1 addition & 0 deletions test/aws/protocol_tests/rest_xml_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule AWS.ProtocolTests.RestXMLTest do
credential_scope: nil,
endpoint_prefix: "foo",
global?: false,
hostname: nil,
protocol: "rest-xml",
service_id: "Foo",
signature_version: "v4",
Expand Down
1 change: 1 addition & 0 deletions test/aws/request_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule AWS.RequestTest do
content_type: "application/x-amz-json-1.1",
endpoint_prefix: "mobileanalytics",
global?: false,
hostname: nil,
protocol: "rest-json",
signature_version: "v4",
signing_name: "mobileanalytics"
Expand Down

0 comments on commit 5741bb2

Please sign in to comment.