#2965 - S3 - GetObject - Treat empty Range-argument as a regular GET (#3531)

This commit is contained in:
Bert Blommers 2021-01-13 10:00:18 +00:00 committed by GitHub
commit df8bd43a45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -4937,3 +4937,16 @@ def test_request_partial_content_should_contain_actual_content_length():
)
e.response["Error"]["ActualObjectSize"].should.equal("9")
e.response["Error"]["RangeRequested"].should.equal(requested_range)
@mock_s3
def test_request_partial_content_without_specifying_range_should_return_full_object():
bucket = "bucket"
object_key = "key"
s3 = boto3.resource("s3", region_name="us-east-1")
s3.create_bucket(Bucket=bucket)
s3.Object(bucket, object_key).put(Body="some text that goes a long way")
file = s3.Object(bucket, object_key)
response = file.get(Range="")
response["ContentLength"].should.equal(30)