diff --git a/src/AWSS3.jl b/src/AWSS3.jl index c6129b2d..13362bad 100644 --- a/src/AWSS3.jl +++ b/src/AWSS3.jl @@ -217,6 +217,9 @@ end [HEAD Object](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html) Retrieves metadata from an object without returning the object itself. + +!!! warning + This function returns the headers from `S3.head_object` as `Dict` of key-value pairs. [HTTP/1.1 headers are case insensitive](https://datatracker.ietf.org/doc/html/rfc2616#section-4.2) while [HTTP/2 headers must be lowercase](https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2). Therefore, the casing of the keys of the returned dict may depend on the HTTP client implementation (e.g. via `AWS.DownloadsBackend` vs `AWS.HTTPBackend`). """ function s3_get_meta( aws::AbstractAWSConfig, bucket, path; version::AbstractS3Version=nothing, kwargs... diff --git a/test/awss3.jl b/test/awss3.jl index 526a212a..919de251 100644 --- a/test/awss3.jl +++ b/test/awss3.jl @@ -98,12 +98,12 @@ function awss3_tests(config) @testset "Check Metadata" begin meta = s3_get_meta(config, bucket_name, "key1") - @test meta["ETag"] == "\"68bc8898af64159b72f349b391a7ae35\"" + @test AWSS3.get_robust_case(meta, "ETag") == "\"68bc8898af64159b72f349b391a7ae35\"" end @testset "default Content-Type" begin # https://github.com/samoconnor/AWSS3.jl/issues/24 - ctype(key) = s3_get_meta(bucket_name, key)["Content-Type"] + ctype(key) = AWSS3.get_robust_case(s3_get_meta(bucket_name, key), "Content-Type") for k in ["file.foo", "file", "file_html", "file.d/html", "foobar.html/file.htm"] is_aws(config) && k == "file" && continue diff --git a/test/runtests.jl b/test/runtests.jl index 92dc42fa..8245bbd1 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -51,8 +51,17 @@ include("awss3.jl") # creates `s3path_tests(config)` # Set `AWSConfig` as the default for the following tests aws = global_aws_config(AWSConfig()) - @testset "S3" begin - awss3_tests(aws) - s3path_tests(aws) + + prev_backend = AWS.DEFAULT_BACKEND[] + for backend in (AWS.HTTPBackend, AWS.DownloadsBackend) + AWS.DEFAULT_BACKEND[] = backend() + try + @testset "S3 with $backend" begin + awss3_tests(aws) + s3path_tests(aws) + end + finally + AWS.DEFAULT_BACKEND[] = prev_backend + end end end diff --git a/test/s3path.jl b/test/s3path.jl index 7c082842..13ddfa3a 100644 --- a/test/s3path.jl +++ b/test/s3path.jl @@ -631,6 +631,8 @@ function s3path_tests(config) alt_region = prev_config.region == "us-east-2" ? "us-east-1" : "us-east-2" try global_aws_config(; region=alt_region) # this is the wrong region! + println("Backend: $(AWS.DEFAULT_BACKEND[])") + read(path, String) @test_throws AWS.AWSException read(path, String) # restore the right region