Add more sanity for HEAD requests

According to HTTP specification, a HTTP server *must not* response
body at HEAD request. For now, Swift3 supports the correct behavior
but it depends on swift.common.swob.Response class and it *might* be
confusable because the code is maintained in another place.

This patch adds unit tests to check both the Response class behavior and
that Swift3 is now following the HTTP specifications.

Change-Id: Ib7e906cb785e84716dbb9ea9d311bbf6a1b5fc2e
Closes-bug: #1464450
This commit is contained in:
Kota Tsuyuzaki
2015-06-14 20:45:00 -07:00
parent 0f71e51ade
commit a49b0dc249
4 changed files with 13 additions and 0 deletions

View File

@@ -273,14 +273,17 @@ class TestSwift3Bucket(Swift3FunctionalTestCase):
status, headers, body = \
self.conn.make_request('HEAD', 'bucket+invalid')
self.assertEquals(status, 400)
self.assertEquals(body, '') # sanifty
auth_error_conn = Connection(aws_secret_key='invalid')
status, headers, body = \
auth_error_conn.make_request('HEAD', 'bucket')
self.assertEquals(status, 403)
self.assertEquals(body, '') # sanifty
status, headers, body = self.conn.make_request('HEAD', 'nothing')
self.assertEquals(status, 404)
self.assertEquals(body, '') # sanifty
def test_delete_bucket_error(self):
status, headers, body = \