fix: compatibility with jmespath, headers."Content-Type"

This commit is contained in:
debugtalk
2020-05-29 11:03:32 +08:00
parent be6d6c93a9
commit dffb096f05
2 changed files with 6 additions and 1 deletions

View File

@@ -18,7 +18,9 @@ def convert_jmespath(raw: Text) -> Text:
raw_list = []
for item in raw.split("."):
if "-" in item:
# add quotes for field with separator, e.g. headers.Content-Type
# add quotes for field with separator
# e.g. headers.Content-Type => headers."Content-Type"
item = item.strip('"')
raw_list.append(f'"{item}"')
elif item.isdigit():
# convert lst.0.name to lst[0].name