refactor: dumps request body if it is in json format, display indented json in html report

This commit is contained in:
debugtalk
2019-12-17 21:52:48 +08:00
parent 80cdcd3318
commit aa253338b6
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -4,7 +4,8 @@
**Changed** **Changed**
- refactor: dumps request and response headers/body, display indented json in report - refactor: dumps request/response headers, display indented json in html report
- refactor: dumps request/response body if it is in json format, display indented json in html report
## 2.4.3 (2019-12-16) ## 2.4.3 (2019-12-16)
+6
View File
@@ -153,6 +153,12 @@ def __stringify_request(request_data):
""" """
for key, value in request_data.items(): for key, value in request_data.items():
if key == "body":
try:
value = json.loads(value)
except json.decoder.JSONDecodeError:
pass
if isinstance(value, (list, dict)): if isinstance(value, (list, dict)):
value = dumps_json(value) value = dumps_json(value)