Skip to content

Commit

Permalink
log body and headers
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Jul 28, 2024
1 parent 411cbdf commit d611ab0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions api/tacticalrmm/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,18 @@ def _run_url_rest_action(*, url: str, method, body: str, headers: str, instance=
new_body = find_and_replace_db_values_str(text=body, instance=instance)
new_headers = find_and_replace_db_values_str(text=headers, instance=instance)
new_url = requote_uri(new_url)
new_body = json.loads(new_body, strict=False)
new_headers = json.loads(new_headers, strict=False)

try:
new_body = json.loads(new_body, strict=False)
except Exception as e:
logger.error(f"{e=} {body=}")
logger.error(f"{new_body=}")

try:
new_headers = json.loads(new_headers, strict=False)
except Exception as e:
logger.error(f"{e=} {headers=}")
logger.error(f"{new_headers=}")

if method in ("get", "delete"):
return getattr(requests, method)(new_url, headers=new_headers)
Expand Down

0 comments on commit d611ab0

Please sign in to comment.