Skip to content

Automate browser based workflows with AI

Fix AsyncHttpClient sending empty body when everything OMITted (#3636)

Stanislav Novosad6b2c2a2cb59d
diff --git a/skyvern/client/core/http_client.py b/skyvern/client/core/http_client.py
index 275a54cc8..ddd1be534 100644
--- a/skyvern/client/core/http_client.py
+++ b/skyvern/client/core/http_client.py
@@ -371,6 +371,16 @@ class AsyncHttpClient:
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
+ # If omit/pruning removed everything, still send {} for methods that commonly expect a body.
+ if (
+ json_body is None
+ and data_body is None
+ and content is None
+ and files is None
+ and method.upper() in {"POST", "PUT", "PATCH"}
+ ):
+ json_body = {}
+
# Add the input to each of these and do None-safety checks
response = await self.httpx_client.request(
method=method,