Merge pull request #1097 from xucong053/master

fix #1079 and #1056
This commit is contained in:
debugtalk
2021-07-13 22:18:04 +08:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ def get_req_resp_record(resp_obj: Response) -> ReqRespData:
def log_print(req_or_resp, r_type):
msg = f"\n================== {r_type} details ==================\n"
for key, value in req_or_resp.dict().items():
if isinstance(value, dict):
if isinstance(value, dict) or isinstance(value, list):
value = json.dumps(value, indent=4, ensure_ascii=False)
msg += "{:<8} : {}\n".format(key, value)

View File

@@ -124,7 +124,7 @@ class RequestData(BaseModel):
url: Url
headers: Headers = {}
cookies: Cookies = {}
body: Union[Text, bytes, Dict, List, None] = {}
body: Union[Text, bytes, List, Dict, None] = {}
class ResponseData(BaseModel):
@@ -133,7 +133,7 @@ class ResponseData(BaseModel):
cookies: Cookies
encoding: Union[Text, None] = None
content_type: Text
body: Union[Text, bytes, Dict, List]
body: Union[Text, bytes, List, Dict]
class ReqRespData(BaseModel):

View File

@@ -151,6 +151,9 @@ class ResponseObject(object):
"cookies": self.cookies,
"body": self.body,
}
if not expr.startswith(tuple(resp_obj_meta.keys())):
return expr
try:
check_value = jmespath.search(expr, resp_obj_meta)
except JMESPathError as ex: