Skip to content

Commit

Permalink
Merge pull request #464 from cknave/case-insensitive-dict-update
Browse files Browse the repository at this point in the history
Update proxy keys on CaseInsensitiveDict.update()
  • Loading branch information
thedrow committed Mar 31, 2017
2 parents 0573457 + 10308cc commit e6c6ddb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions oauthlib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ def __setitem__(self, k, v):
super(CaseInsensitiveDict, self).__setitem__(k, v)
self.proxy[k.lower()] = k

def update(self, *args, **kwargs):
super(CaseInsensitiveDict, self).update(*args, **kwargs)
for k in dict(*args, **kwargs):
self.proxy[k.lower()] = k


class Request(object):

Expand Down
5 changes: 5 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ def test_basic(self):
del cid['c']
self.assertEqual(cid['A'], 'b')
self.assertEqual(cid['a'], 'b')

def test_update(self):
cid = CaseInsensitiveDict({})
cid.update({'KeY': 'value'})
self.assertEqual(cid['kEy'], 'value')

0 comments on commit e6c6ddb

Please sign in to comment.