fix(workflow): ensure default values are properly retrieved in HTTP nodes
This commit is contained in:
@@ -63,7 +63,7 @@ class HttpContentTypeConfig(BaseModel):
|
||||
)
|
||||
|
||||
data: list[HttpFormData] | dict | str = Field(
|
||||
...,
|
||||
default="",
|
||||
description="Data of the HTTP request body; type depends on content_type",
|
||||
)
|
||||
|
||||
@@ -98,6 +98,10 @@ class HttpTimeOutConfig(BaseModel):
|
||||
|
||||
|
||||
class HttpRetryConfig(BaseModel):
|
||||
enable: bool = Field(
|
||||
...,
|
||||
description="Enable/disable retry logic",
|
||||
)
|
||||
max_attempts: int = Field(
|
||||
default=1,
|
||||
description="Maximum number of retry attempts for failed requests",
|
||||
@@ -124,6 +128,11 @@ class HttpErrorDefaultTamplete(BaseModel):
|
||||
description="Default HTTP headers returned on error",
|
||||
)
|
||||
|
||||
output: str = Field(
|
||||
default="SUCCESS",
|
||||
description="HTTP response body",
|
||||
)
|
||||
|
||||
|
||||
class HttpErrorHandleConfig(BaseModel):
|
||||
method: HttpErrorHandle = Field(
|
||||
@@ -131,8 +140,8 @@ class HttpErrorHandleConfig(BaseModel):
|
||||
description="Error handling strategy: 'none', 'default', or 'branch'",
|
||||
)
|
||||
|
||||
default: HttpErrorDefaultTamplete = Field(
|
||||
...,
|
||||
default: HttpErrorDefaultTamplete | None = Field(
|
||||
default=None,
|
||||
description="Default response template for error handling",
|
||||
)
|
||||
|
||||
|
||||
@@ -165,24 +165,6 @@ class HttpRequestNode(BaseNode):
|
||||
case _:
|
||||
raise RuntimeError(f"HttpRequest method not supported: {self.typed_config.method}")
|
||||
|
||||
def build_conditional_edge_expressions(self):
|
||||
"""
|
||||
Build conditional edge expressions for workflow branching.
|
||||
|
||||
When the HTTP error handling strategy is set to `BRANCH`,
|
||||
this node exposes a single conditional output labeled "ERROR".
|
||||
The workflow engine uses this output to create an explicit
|
||||
error-handling branch for downstream nodes.
|
||||
|
||||
Returns:
|
||||
list[str]:
|
||||
- ["ERROR"] if error handling strategy is BRANCH
|
||||
- An empty list if no conditional branching is required
|
||||
"""
|
||||
if self.typed_config.error_handle.method == HttpErrorHandle.BRANCH:
|
||||
return ["ERROR"]
|
||||
return []
|
||||
|
||||
async def execute(self, state: WorkflowState) -> dict | str:
|
||||
"""
|
||||
Execute the HTTP request node.
|
||||
|
||||
Reference in New Issue
Block a user