This commit is contained in:
parent
77dd35e3b8
commit
df8bd43a45
@ -975,7 +975,11 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
|
|||||||
else:
|
else:
|
||||||
status_code, response_headers, response_content = response
|
status_code, response_headers, response_content = response
|
||||||
|
|
||||||
if status_code == 200 and "range" in request.headers:
|
if (
|
||||||
|
status_code == 200
|
||||||
|
and "range" in request.headers
|
||||||
|
and request.headers["range"] != ""
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
return self._handle_range_header(
|
return self._handle_range_header(
|
||||||
request, response_headers, response_content
|
request, response_headers, response_content
|
||||||
|
@ -4937,3 +4937,16 @@ def test_request_partial_content_should_contain_actual_content_length():
|
|||||||
)
|
)
|
||||||
e.response["Error"]["ActualObjectSize"].should.equal("9")
|
e.response["Error"]["ActualObjectSize"].should.equal("9")
|
||||||
e.response["Error"]["RangeRequested"].should.equal(requested_range)
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user