Skip to content

Commit

Permalink
Parse json and make it into a dict instead, converting js/json-style …
Browse files Browse the repository at this point in the history
…true to python-style True.
  • Loading branch information
cyberw committed Mar 15, 2024
1 parent 47ec2f6 commit 5d3eb90
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions har2locust/default_plugins/rest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

from har2locust.plugin import entriesprocessor


Expand All @@ -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()

Expand Down

0 comments on commit 5d3eb90

Please sign in to comment.