swift3 missing content type fix
This commit is contained in:
parent
bfc490f624
commit
fc3e894cbd
@ -132,7 +132,7 @@ def canonical_string(req):
|
||||
Canonicalize a request to a token that can be signed.
|
||||
"""
|
||||
buf = "%s\n%s\n%s\n" % (req.method, req.headers.get('Content-MD5', ''),
|
||||
req.headers.get('Content-Type', ''))
|
||||
req.headers.get('Content-Type') or '')
|
||||
if 'Date' in req.headers:
|
||||
buf += "%s\n" % req.headers['Date']
|
||||
for amz_header in sorted((key.lower() for key in req.headers
|
||||
|
@ -580,5 +580,20 @@ class TestSwift3(unittest.TestCase):
|
||||
'X-Amz-Z': 'whatever', 'X-Amz-B': 'lalala',
|
||||
'X-Amz-Y': 'lalalalalalala'})
|
||||
|
||||
verify('7506d97002c7d2de922cc0ec34af8846', '/bucket/object',
|
||||
{'Content-Type': '', 'X-Amz-Something': 'test'})
|
||||
|
||||
|
||||
req1 = Request.blank('/', headers=
|
||||
{'Content-Type': None, 'X-Amz-Something': 'test'})
|
||||
req2 = Request.blank('/', headers=
|
||||
{'Content-Type': '', 'X-Amz-Something': 'test'})
|
||||
req3 = Request.blank('/', headers={'X-Amz-Something': 'test'})
|
||||
|
||||
self.assertEquals(swift3.canonical_string(req1),
|
||||
swift3.canonical_string(req2))
|
||||
self.assertEquals(swift3.canonical_string(req2),
|
||||
swift3.canonical_string(req3))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user