mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 10:17:55 +00:00
fix: api tool avoid sending body if empty
This commit is contained in:
1 parent
b523a98289
commit
4fd6c52951
1 file changed
+2
-1
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user