Skip to content
Myr

Merge pull request #1092 from jianlius/case-insensitive-update

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Make merge_kwargs case-insensitive when looking up keys.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 6ec1a9c, a392a87 · Browse files · 1 file+13 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−2 removed

  • other:+13 added−2 removed

1 file+13 added−2 removed

modified:requests/sessions.py+13 added-2 removed
47 unmodified lines
4849 default_kwarg = from_key_val_list(default_kwarg)50 local_kwarg = from_key_val_list(local_kwarg)5152 # Update new values.52 # Update new values in a case-insensitive way53 def get_original_key(original_keys, new_key):54 """55 Finds the key from original_keys that case-insensitive matches new_key.56 """57 for original_key in original_keys:58 if key.lower() == original_key.lower():59 return original_key60 return new_key6162 kwargs = default_kwarg.copy()54 kwargs.update(local_kwarg)63 original_keys = kwargs.keys()64 for key, value in local_kwarg.items():65 kwargs[get_original_key(original_keys, key)] = value6667 # Remove keys that are set to None.68 for (k, v) in local_kwarg.items():69 if v is None:
339 unmodified lines