From 4fd6c52951f8c3d9c4d842b86871333e85dbdce7 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Mar 2025 14:34:23 +0000 Subject: [PATCH] fix: api tool avoid sending body if empty --- application/agents/tools/api_tool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/agents/tools/api_tool.py b/application/agents/tools/api_tool.py index 06d5fb7a..092c3569 100644 --- a/application/agents/tools/api_tool.py +++ b/application/agents/tools/api_tool.py @@ -29,9 +29,10 @@ class APITool(Tool): body = json.dumps(body) try: print(f"Making API call: {method} {url} with body: {body}") + if body == "{}": + body = None response = requests.request(method, url, headers=headers, data=body) response.raise_for_status() - content_type = response.headers.get( "Content-Type", "application/json" ).lower()