self.assertEqual(r.status_code, 200)
def test_fixes_1329(self):
+ """
+ Ensure that header updates are done case-insensitively.
+ """
s = requests.Session()
+ s.headers.update({'ACCEPT': 'BOGUS'})
s.headers.update({'accept': 'application/json'})
r = s.get(httpbin('get'))
headers = r.request.headers
headers['Accept'.encode('ascii')],
'application/json'
)
+ self.assertEqual(
+ headers['ACCEPT'.encode('ascii')],
+ 'application/json'
+ )
class TestCaseInsensitiveDict(unittest.TestCase):
self.assertEqual(cid['SPAM'], 'blueval')
def test_fixes_649(self):
+ """__setitem__ should behave case-insensitively."""
cid = CaseInsensitiveDict()
cid['spam'] = 'oneval'
cid['Spam'] = 'twoval'