bugfix: represent unicode literals in html report

This commit is contained in:
debugtalk
2018-03-27 17:29:05 +08:00
parent 7d15096974
commit a1357834b4
3 changed files with 11 additions and 6 deletions

View File

@@ -113,12 +113,16 @@ class HttpSession(requests.Session):
self.meta_data["request_body"] = response.request.body
self.meta_data["status_code"] = response.status_code
self.meta_data["response_headers"] = response.headers
self.meta_data["response_content"] = response.content
try:
self.meta_data["response_body"] = response.json()
except ValueError:
self.meta_data["response_body"] = response.content
msg = "response details:\n"
msg += "> status_code: {}\n".format(self.meta_data["status_code"])
msg += "> headers: {}\n".format(self.meta_data["response_headers"])
msg += "> content: {}".format(self.meta_data["response_content"])
msg += "> body: {}".format(self.meta_data["response_body"])
logger.log_debug(msg)
# get the length of the content, but if the argument stream is set to True, we take