Skip to content

Commit

Permalink
Merge #563
Browse files Browse the repository at this point in the history
563: Fix error type for HTTP 1.0 r=mattBrzezinski a=JackDunnNZ

Fixes #558, ref #558 (comment)

Co-authored-by: Jack Dunn <[email protected]>
  • Loading branch information
bors[bot] and JackDunnNZ authored Jun 30, 2022
2 parents 9bf7d8d + fbb0782 commit d683822
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AWSCredentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion test/patch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d683822

Please sign in to comment.