summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer Katz <omer.drow@gmail.com>2017-03-31 12:05:13 +0300
committerGitHub <noreply@github.com>2017-03-31 12:05:13 +0300
commite6c6ddb8fd25032d51a07623d549f310ded68fc8 (patch)
tree965eb5cfeaccaa55e85f8b610bd73f27ad3b02b1
parent0573457a1f32417f9b280b5102a123ee49739bbf (diff)
parent10308ccdf1d6fc92cfed8a3b25779e7cbb73f9b0 (diff)
downloadoauthlib-e6c6ddb8fd25032d51a07623d549f310ded68fc8.tar.gz
Merge pull request #464 from cknave/case-insensitive-dict-update
Update proxy keys on CaseInsensitiveDict.update()
-rw-r--r--oauthlib/common.py5
-rw-r--r--tests/test_common.py5
2 files changed, 10 insertions, 0 deletions
diff --git a/oauthlib/common.py b/oauthlib/common.py
index 5d999b2..705cbd2 100644
--- a/oauthlib/common.py
+++ b/oauthlib/common.py
@@ -354,6 +354,11 @@ class CaseInsensitiveDict(dict):
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):
diff --git a/tests/test_common.py b/tests/test_common.py
index 078b67b..4f95cd8 100644
--- a/tests/test_common.py
+++ b/tests/test_common.py
@@ -228,3 +228,8 @@ class CaseInsensitiveDictTest(TestCase):
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')