From 5d3eb901cae16fb901f8cea3a63bae195e7eaf36 Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Fri, 15 Mar 2024 09:30:34 +0100 Subject: [PATCH] Parse json and make it into a dict instead, converting js/json-style true to python-style True. --- har2locust/default_plugins/rest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/har2locust/default_plugins/rest.py b/har2locust/default_plugins/rest.py index 23b5259..426dd44 100644 --- a/har2locust/default_plugins/rest.py +++ b/har2locust/default_plugins/rest.py @@ -1,3 +1,5 @@ +import json + from har2locust.plugin import entriesprocessor @@ -13,6 +15,8 @@ def rest(entries: list[dict]): or r["postData"]["mimeType"] == "application/json" # json payload, also ok ): # logging.debug(f"{r['url']} is a rest request!") + if "postData" in r and "text" in r["postData"]: + r["postData"]["text"] = json.loads(r["postData"]["text"]) r["fname"] = "rest" r["extraparams"] = [] # catch_response=True is already the default for .rest()