Skip to content
Myr

Make merge_kwargs case-insensitive when looking up keys.

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

authored by Jian Li · committed by Jian Li · parent b450528 · Browse files · 1 file+12 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+12 added−2 removed

  • other:+12 added−2 removed

1 file+12 added−2 removed

modified:requests/sessions.py+12 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 for key, value in local_kwarg.items():64 kwargs[get_original_key(kwargs.keys(), key)] = value6566 # Remove keys that are set to None.67 for (k, v) in local_kwarg.items():68 if v is None:
339 unmodified lines