Skip to content

Commit

Permalink
Set region to nothing for Route53 endpoint when making service URL
Browse files Browse the repository at this point in the history
  • Loading branch information
mattBrzezinski committed Jan 28, 2020
1 parent 19a921f commit 4e256a7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AWSCore"
uuid = "4f1ea46c-232b-54a6-9b17-cc2d0f3e6598"
version = "0.6.7"
version = "0.6.8"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
17 changes: 12 additions & 5 deletions src/AWSCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,20 @@ Service endpoint URL for `request`.
"""
function service_url(aws, request)
endpoint = get(request, :endpoint, request[:service])
region = "." * aws[:region]
if endpoint == "iam" || (endpoint == "sdb" && region == ".us-east-1") || region=="."
region = aws[:region]
regionless_endpoints = ("iam", "route53")

if endpoint in regionless_endpoints || (endpoint == "sdb" && region == "us-east-1")
region = ""
end
service_host = get(aws,:service_host,"amazonaws.com")
string("https://", endpoint, region, ".", service_host,
request[:resource])

service_host = get(aws, :service_host, "amazonaws.com")

if !isempty(region)
return string("https://", endpoint, ".", region, ".", service_host, request[:resource])
else
return string("https://", endpoint, ".", service_host, request[:resource])
end
end


Expand Down
12 changes: 12 additions & 0 deletions test/endpoints.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using AWSCore.Services: route53

@testset "Endpoints" begin
@testset "Route53" begin
try
route53("GET", "/2013-04-01/accountlimit/MAX_HEALTH_CHECKS_BY_OWNER")
@test true
catch
@test false
end
end
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ aws = aws_config()
include("arn.jl")
include("credentials.jl")
include("exceptions.jl")
include("endpoints.jl")
include("localhost.jl")
include("signaturev4.jl")
include("xml.jl")
Expand Down

0 comments on commit 4e256a7

Please sign in to comment.