浏览代码

fix: improve JSON parsing error handling in Executor class (#12265)

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/0.15.0
-LAN- 10 个月前
父节点
当前提交
c7911c7130
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      api/core/workflow/nodes/http_request/executor.py

+ 4
- 1
api/core/workflow/nodes/http_request/executor.py 查看文件

@@ -158,7 +158,10 @@ class Executor:
if len(data) != 1:
raise RequestBodyError("json body type should have exactly one item")
json_string = self.variable_pool.convert_template(data[0].value).text
json_object = json.loads(json_string, strict=False)
try:
json_object = json.loads(json_string, strict=False)
except json.JSONDecodeError as e:
raise RequestBodyError(f"Failed to parse JSON: {json_string}") from e
self.json = json_object
# self.json = self._parse_object_contains_variables(json_object)
case "binary":

正在加载...
取消
保存