Skip to content

Automate browser based workflows with AI

honor x-www-form-urlencoded in http block (#4232)

Marc Kelechava5e3211afacfb
diff --git a/skyvern/config.py b/skyvern/config.py
index 57cbf0709..341c76c33 100644
--- a/skyvern/config.py
+++ b/skyvern/config.py
@@ -291,7 +291,7 @@ class Settings(BaseSettings):
# GEMINI
GEMINI_API_KEY: str | None = None
GEMINI_INCLUDE_THOUGHT: bool = False
- GEMINI_THINKING_BUDGET: int | None = 500
+ GEMINI_THINKING_BUDGET: int | None = None
# VERTEX_AI
VERTEX_CREDENTIALS: str | None = None
diff --git a/skyvern/forge/sdk/core/aiohttp_helper.py b/skyvern/forge/sdk/core/aiohttp_helper.py
index 1ce597e69..cd9ef914c 100644
--- a/skyvern/forge/sdk/core/aiohttp_helper.py
+++ b/skyvern/forge/sdk/core/aiohttp_helper.py
@@ -14,6 +14,8 @@ async def aiohttp_request(
method: str,
url: str,
headers: dict[str, str] | None = None,
+ *,
+ body: dict[str, Any] | str | None = None,
data: dict[str, Any] | None = None,
json_data: dict[str, Any] | None = None,
cookies: dict[str, str] | None = None,
@@ -39,10 +41,17 @@ async def aiohttp_request(
# Handle body based on content type and method
if method.upper() != "GET":
+ # Explicit overrides first
if json_data is not None:
request_kwargs["json"] = json_data
elif data is not None:
request_kwargs["data"] = data
+ elif body is not None:
+ content_type = (headers or {}).get("Content-Type") or (headers or {}).get("content-type") or ""
+ if "application/x-www-form-urlencoded" in content_type.lower():
+ request_kwargs["data"] = body
+ else:
+ request_kwargs["json"] = body
async with session.request(method.upper(), **request_kwargs) as response:
response_headers = dict(response.headers)
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index 80aaf9467..9322d6c01 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -3891,7 +3891,7 @@ class HttpRequestBlock(Block):
method=self.method,
url=self.url,
headers=self.headers,
- json_data=self.body,
+ body=self.body,
timeout=self.timeout,
follow_redirects=self.follow_redirects,
)