mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
refactor: dumps request body if it is in json format, display indented json in html report
This commit is contained in:
+2
-1
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user