From bc822d494984ad9cb14cec6edbea053472a59421 Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Mon, 28 Oct 2024 11:04:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20http=20=E6=8F=92=E4=BB=B6=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20json=20=E8=BD=AC=E4=B9=89=20#40?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bkflow/pipeline_plugins/components/collections/http/v1_0.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bkflow/pipeline_plugins/components/collections/http/v1_0.py b/bkflow/pipeline_plugins/components/collections/http/v1_0.py index be15c56..c36aa98 100644 --- a/bkflow/pipeline_plugins/components/collections/http/v1_0.py +++ b/bkflow/pipeline_plugins/components/collections/http/v1_0.py @@ -21,6 +21,7 @@ from __future__ import absolute_import +import json import traceback from copy import deepcopy @@ -133,6 +134,8 @@ def plugin_schedule(self, data, parent_data, callback_data=None): other = {"headers": {}, "timeout": timeout} if method.upper() not in ["GET", "HEAD"]: + if not isinstance(body, str): + body = json.dumps(body) other["data"] = body.encode("utf-8") other["headers"] = {"Content-type": "application/json"}