mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-28 03:40:13 +08:00
fix: keep negative index in jmespath unchanged when converting pytest files
This commit is contained in:
@@ -58,9 +58,11 @@ def _convert_jmespath(raw: Text) -> Text:
|
||||
|
||||
raw_list = []
|
||||
for item in raw.split("."):
|
||||
if "-" in item:
|
||||
if "-" in item and "[-" not in item:
|
||||
# add quotes for field with separator
|
||||
# e.g. headers.Content-Type => headers."Content-Type"
|
||||
# also need to avoid replacing negative index in jmespath
|
||||
# e.g. body.users[-1] => body.users[-1], keep unchanged
|
||||
item = item.strip('"')
|
||||
raw_list.append(f'"{item}"')
|
||||
elif item.isdigit():
|
||||
|
||||
Reference in New Issue
Block a user