diff --git a/src/AWSCredentials.jl b/src/AWSCredentials.jl index 01b0ba366e..687abeed9a 100644 --- a/src/AWSCredentials.jl +++ b/src/AWSCredentials.jl @@ -216,7 +216,7 @@ function ec2_instance_metadata(path::AbstractString) request = try @mock HTTP.request("GET", uri; connect_timeout=1) catch e - if e isa HTTP.ConnectionPool.ConnectTimeout + if e isa HTTP.ConnectError nothing else rethrow() diff --git a/test/patch.jl b/test/patch.jl index bdf61f127d..9aab638ce3 100644 --- a/test/patch.jl +++ b/test/patch.jl @@ -129,7 +129,12 @@ end _instance_metadata_timeout_patch = @patch function HTTP.request( method::String, url; kwargs... ) - return throw(HTTP.ConnectionPool.ConnectTimeout("169.254.169.254", "80")) + return throw( + HTTP.ConnectError( + "http://169.254.169.254/latest/meta-data/iam/info", + HTTP.ConnectionPool.ConnectTimeout("169.254.169.254", "80"), + ), + ) end # This patch causes `HTTP.request` to return all of its keyword arguments