From ea96013957fe5138d541bc60e8dff1f86f234ab6 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Fri, 24 Mar 2023 10:55:56 -0100 Subject: [PATCH] S3: get_object() now returns the AcceptRanges header (#6121) --- moto/s3/responses.py | 1 + tests/test_s3/test_server.py | 1 + 2 files changed, 2 insertions(+) diff --git a/moto/s3/responses.py b/moto/s3/responses.py index d6e0cf1bb..eac342b9f 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -1364,6 +1364,7 @@ class S3Response(BaseResponse): response_headers.update(key.metadata) response_headers.update(key.response_dict) + response_headers.update({"AcceptRanges": "bytes"}) return 200, response_headers, key.value def _key_response_put(self, request, body, bucket_name, query, key_name): diff --git a/tests/test_s3/test_server.py b/tests/test_s3/test_server.py index 778ef1e8a..b2e41974d 100644 --- a/tests/test_s3/test_server.py +++ b/tests/test_s3/test_server.py @@ -73,6 +73,7 @@ def test_s3_server_bucket_create(key_name): res = test_client.get(f"/{key_name}", "http://foobaz.localhost:5000/") res.status_code.should.equal(200) res.data.should.equal(b"test value") + assert res.headers.get("AcceptRanges") == "bytes" def test_s3_server_ignore_subdomain_for_bucketnames():