Skip to content

Commit 3a14dd3

Browse files
committed
🐛 Fix: parse request body to make it compatible with request
1 parent 33e0e93 commit 3a14dd3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/vuegen/config_manager.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,15 @@ def _create_apicall_component(self, component_data: dict) -> r.APICall:
561561
APICall
562562
An APICall object populated with the provided metadata.
563563
"""
564+
request_body = component_data.get("request_body")
565+
parsed_body = None
566+
if request_body:
567+
try:
568+
parsed_body = json.loads(request_body)
569+
except json.JSONDecodeError as e:
570+
self.logger.error(f"Failed to parse request_body JSON: {e}")
571+
raise ValueError(f"Invalid JSON in request_body: {e}")
572+
564573
return r.APICall(
565574
title=component_data["title"],
566575
logger=self.logger,
@@ -569,7 +578,7 @@ def _create_apicall_component(self, component_data: dict) -> r.APICall:
569578
caption=component_data.get("caption"),
570579
headers=component_data.get("headers"),
571580
params=component_data.get("params"),
572-
request_body=component_data.get("request_body"),
581+
request_body=parsed_body,
573582
)
574583

575584
def _create_chatbot_component(self, component_data: dict) -> r.ChatBot:

0 commit comments

Comments
 (0)