From 48c57384c5be17d764d99ee9b26c43bb4b1a675f Mon Sep 17 00:00:00 2001 From: George Leslie-Waksman Date: Mon, 13 Jun 2016 13:24:09 -0700 Subject: [PATCH] Return headers and response matching AWS specification for copy_from requests. --- moto/s3/responses.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/moto/s3/responses.py b/moto/s3/responses.py index 5c9711e34..0a7566538 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -445,13 +445,14 @@ class ResponseObject(_TemplateEnvironmentMixin): src_version_id = parse_qs(src_key_parsed.query).get('versionId', [None])[0] self.backend.copy_key(src_bucket, src_key, bucket_name, key_name, storage=storage_class, acl=acl, src_version_id=src_version_id) + new_key = self.backend.get_key(bucket_name, key_name) mdirective = request.headers.get('x-amz-metadata-directive') if mdirective is not None and mdirective == 'REPLACE': - new_key = self.backend.get_key(bucket_name, key_name) metadata = metadata_from_headers(request.headers) new_key.set_metadata(metadata, replace=True) template = self.response_template(S3_OBJECT_COPY_RESPONSE) - return template.render(key=src_key) + headers.update(new_key.response_dict) + return 200, headers, template.render(key=new_key) streaming_request = hasattr(request, 'streaming') and request.streaming closing_connection = headers.get('connection') == 'close' if closing_connection and streaming_request: @@ -771,12 +772,11 @@ S3_OBJECT_ACL_RESPONSE = """ """ -S3_OBJECT_COPY_RESPONSE = """ - +S3_OBJECT_COPY_RESPONSE = """\ + {{ key.etag }} {{ key.last_modified_ISO8601 }} - -""" +""" S3_MULTIPART_INITIATE_RESPONSE = """