s3: handle WebsiteRedirectLocation

spulec/moto#821
This commit is contained in:
Dmytro Milinevskyy 2017-04-14 13:32:52 +02:00
commit 6e61ee4caa
3 changed files with 18 additions and 0 deletions

View file

@ -25,6 +25,7 @@ class FakeKey(BaseModel):
self.value = value
self.last_modified = datetime.datetime.utcnow()
self.acl = get_canned_acl('private')
self.website_redirect_location = None
self._storage_class = storage if storage else "STANDARD"
self._metadata = {}
self._expiry = None
@ -103,6 +104,9 @@ class FakeKey(BaseModel):
if self._is_versioned:
res['x-amz-version-id'] = str(self._version_id)
if self.website_redirect_location:
res['x-amz-website-redirect-location'] = self.website_redirect_location
return res
@property

View file

@ -570,6 +570,7 @@ class ResponseObject(_TemplateEnvironmentMixin):
metadata = metadata_from_headers(request.headers)
new_key.set_metadata(metadata)
new_key.set_acl(acl)
new_key.website_redirect_location = request.headers.get('x-amz-website-redirect-location')
template = self.response_template(S3_OBJECT_RESPONSE)
response_headers.update(new_key.response_dict)