diff options
author | Kevin Vance <kevinv@aweber.com> | 2017-02-23 15:26:36 -0500 |
---|---|---|
committer | Kevin Vance <kevinv@aweber.com> | 2017-02-23 15:26:36 -0500 |
commit | 10308ccdf1d6fc92cfed8a3b25779e7cbb73f9b0 (patch) | |
tree | e1564975a873d9897eeaf097c16c68a1afb67fa4 | |
parent | d2c7be6c38c9cc2dd3f5ba0dffaf38be42fcb418 (diff) | |
download | oauthlib-10308ccdf1d6fc92cfed8a3b25779e7cbb73f9b0.tar.gz |
Update proxy keys on CaseInsensitiveDict.update()
-rw-r--r-- | oauthlib/common.py | 5 | ||||
-rw-r--r-- | tests/test_common.py | 5 |
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') |