bugfix: keys that are not in 'request' of config shall not be lower cased

This commit is contained in:
debugtalk
2017-09-20 21:06:32 +08:00
parent 8d3a423e88
commit f38b63d240
3 changed files with 15 additions and 4 deletions

View File

@@ -300,7 +300,7 @@ def lower_dict_key(origin_dict, depth=1):
new_dict = {}
for key, value in origin_dict.items():
if depth > 2:
if depth >= 2:
new_dict[key] = value
continue
@@ -311,6 +311,17 @@ def lower_dict_key(origin_dict, depth=1):
return new_dict
def lower_config_dict_key(config_dict):
""" convert key in config dict to lower case, convertion will occur in two places:
1, all keys in config dict;
2, all keys in config["request"]
"""
config_dict = lower_dict_key(config_dict)
if "request" in config_dict and isinstance(config_dict["request"], dict):
config_dict["request"] = lower_dict_key(config_dict["request"])
return config_dict
def convert_to_order_dict(map_list):
""" convert mapping in list to ordered dict
@param (list) map_list