mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 22:39:42 +08:00
bugfix #34: handle exception when response content is empty
This commit is contained in:
@@ -31,10 +31,13 @@ class ResponseObject(object):
|
||||
"content.person.name.first_name"
|
||||
"""
|
||||
try:
|
||||
field += "."
|
||||
# string.split(sep=None, maxsplit=-1) -> list of strings
|
||||
# e.g. "content.person.name" => ["content", "person.name"]
|
||||
top_query, sub_query = field.split(delimiter, 1)
|
||||
try:
|
||||
top_query, sub_query = field.split(delimiter, 1)
|
||||
except ValueError:
|
||||
top_query = field
|
||||
sub_query = None
|
||||
|
||||
if top_query in ["body", "content", "text"]:
|
||||
json_content = self.parsed_body()
|
||||
|
||||
Reference in New Issue
Block a user