Skip to content

Commit d35f531

Browse files
authored
Try #262:
2 parents 232b230 + ccf8342 commit d35f531

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/AWSS3.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ end
217217
[HEAD Object](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html)
218218
219219
Retrieves metadata from an object without returning the object itself.
220+
221+
!!! warning
222+
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`).
220223
"""
221224
function s3_get_meta(
222225
aws::AbstractAWSConfig, bucket, path; version::AbstractS3Version=nothing, kwargs...

test/awss3.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function awss3_tests(config)
103103

104104
@testset "default Content-Type" begin
105105
# https://github.com/samoconnor/AWSS3.jl/issues/24
106-
ctype(key) = s3_get_meta(bucket_name, key)["Content-Type"]
106+
ctype(key) = AWSS3.get_robust_case(s3_get_meta(bucket_name, key), "Content-Type")
107107

108108
for k in ["file.foo", "file", "file_html", "file.d/html", "foobar.html/file.htm"]
109109
is_aws(config) && k == "file" && continue

test/runtests.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,17 @@ include("awss3.jl") # creates `s3path_tests(config)`
5151

5252
# Set `AWSConfig` as the default for the following tests
5353
aws = global_aws_config(AWSConfig())
54-
@testset "S3" begin
55-
awss3_tests(aws)
56-
s3path_tests(aws)
54+
55+
prev_backend = AWS.DEFAULT_BACKEND[]
56+
for backend in (AWS.HTTPBackend, AWS.DownloadsBackend)
57+
AWS.DEFAULT_BACKEND[] = backend()
58+
try
59+
@testset "S3 with $backend" begin
60+
awss3_tests(aws)
61+
s3path_tests(aws)
62+
end
63+
finally
64+
AWS.DEFAULT_BACKEND[] = prev_backend
65+
end
5766
end
5867
end

0 commit comments

Comments
 (0)