Add content-disposition header to tempurl request
Added content-disposition header to HEAD tempurl request. As per HTTP docs[1] HEAD response must be identical to GET except return message-body response. [1]https://tools.ietf.org/html/rfc2616#section-9.4 Change-Id: Ie60a6fb632613055da5279db5b128ce5ee5172ae Closes-Bug:#1539805
This commit is contained in:
parent
99186aded9
commit
6f78646ea2
@ -202,7 +202,7 @@ class TestTempURL(unittest.TestCase):
|
|||||||
self.assertEqual(req.environ['swift.authorize_override'], True)
|
self.assertEqual(req.environ['swift.authorize_override'], True)
|
||||||
self.assertEqual(req.environ['REMOTE_USER'], '.wsgi.tempurl')
|
self.assertEqual(req.environ['REMOTE_USER'], '.wsgi.tempurl')
|
||||||
|
|
||||||
def test_head_valid(self):
|
def test_head_valid_with_filename(self):
|
||||||
method = 'HEAD'
|
method = 'HEAD'
|
||||||
expires = int(time() + 86400)
|
expires = int(time() + 86400)
|
||||||
path = '/v1/a/c/o'
|
path = '/v1/a/c/o'
|
||||||
@ -211,11 +211,14 @@ class TestTempURL(unittest.TestCase):
|
|||||||
sig = hmac.new(key, hmac_body, sha1).hexdigest()
|
sig = hmac.new(key, hmac_body, sha1).hexdigest()
|
||||||
req = self._make_request(path, keys=[key], environ={
|
req = self._make_request(path, keys=[key], environ={
|
||||||
'REQUEST_METHOD': 'HEAD',
|
'REQUEST_METHOD': 'HEAD',
|
||||||
'QUERY_STRING': 'temp_url_sig=%s&temp_url_expires=%s'
|
'QUERY_STRING': 'temp_url_sig=%s&temp_url_expires=%s&'
|
||||||
% (sig, expires)})
|
'filename=bob_killer.txt' % (sig, expires)})
|
||||||
self.tempurl.app = FakeApp(iter([('200 Ok', (), '123')]))
|
self.tempurl.app = FakeApp(iter([('200 Ok', (), '123')]))
|
||||||
resp = req.get_response(self.tempurl)
|
resp = req.get_response(self.tempurl)
|
||||||
self.assertEqual(resp.status_int, 200)
|
self.assertEqual(resp.status_int, 200)
|
||||||
|
self.assertEqual(resp.headers['content-disposition'],
|
||||||
|
'attachment; filename="bob_killer.txt"; ' +
|
||||||
|
"filename*=UTF-8''bob_killer.txt")
|
||||||
|
|
||||||
def test_head_and_get_headers_match(self):
|
def test_head_and_get_headers_match(self):
|
||||||
method = 'HEAD'
|
method = 'HEAD'
|
||||||
|
Loading…
Reference in New Issue
Block a user