fix bug with swob.Request accept property
Change-Id: I2c1246b9bbd1d3ab22c2a035b735d937dd90da11
This commit is contained in:
parent
8cacf5aaf8
commit
583850e866
|
@ -611,7 +611,7 @@ class Request(object):
|
|||
"""
|
||||
range = _req_fancy_property(Range, 'range')
|
||||
if_none_match = _req_fancy_property(Match, 'if-none-match')
|
||||
accept = _req_fancy_property(Accept, 'http-accept', True)
|
||||
accept = _req_fancy_property(Accept, 'accept', True)
|
||||
method = _req_environ_property('REQUEST_METHOD')
|
||||
referrer = referer = _req_environ_property('HTTP_REFERER')
|
||||
script_name = _req_environ_property('SCRIPT_NAME')
|
||||
|
|
|
@ -298,6 +298,17 @@ class TestRequest(unittest.TestCase):
|
|||
req.range = 'bad range'
|
||||
self.assertEquals(req.range, None)
|
||||
|
||||
def test_accept_header(self):
|
||||
req = swift.common.swob.Request({'REQUEST_METHOD': 'GET',
|
||||
'PATH_INFO': '/',
|
||||
'HTTP_ACCEPT': 'application/json'})
|
||||
self.assertEqual(
|
||||
req.accept.best_match(['application/json', 'text/plain']),
|
||||
'application/json')
|
||||
self.assertEqual(
|
||||
req.accept.best_match(['text/plain', 'application/json']),
|
||||
'application/json')
|
||||
|
||||
|
||||
class TestStatusMap(unittest.TestCase):
|
||||
def test_status_map(self):
|
||||
|
|
Loading…
Reference in New Issue