From d611ab0ee28fe0df129c2f2b4102cf35dda91c0e Mon Sep 17 00:00:00 2001 From: wh1te909 <7434746+wh1te909@users.noreply.github.com> Date: Sun, 28 Jul 2024 22:54:22 +0000 Subject: [PATCH] log body and headers --- api/tacticalrmm/core/utils.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/tacticalrmm/core/utils.py b/api/tacticalrmm/core/utils.py index 699a092090..14bda469d7 100644 --- a/api/tacticalrmm/core/utils.py +++ b/api/tacticalrmm/core/utils.py @@ -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)