From 49ecfad6b1f68786d9e2ed1a0223316f60994927 Mon Sep 17 00:00:00 2001 From: Gilles Dartiguelongue Date: Mon, 10 Feb 2014 12:18:06 +0100 Subject: [PATCH] Implement HEAD method due to changes in boto 2.25, closes: #91 --- moto/s3/responses.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/moto/s3/responses.py b/moto/s3/responses.py index d9b014206..83b53cb99 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -42,7 +42,14 @@ class ResponseObject(object): # If no bucket specified, list all buckets return self.all_buckets() - if method == 'GET': + if method == 'HEAD': + bucket = self.backend.get_bucket(bucket_name) + if bucket: + return 200, headers, "" + else: + return 404, headers, "" + + elif method == 'GET': bucket = self.backend.get_bucket(bucket_name) if bucket: prefix = querystring.get('prefix', [None])[0]