Skip to content

Commit

Permalink
feat: http 插件支持 json 转义 #40
Browse files Browse the repository at this point in the history
  • Loading branch information
guohelu authored and normal-wls committed Oct 28, 2024
1 parent 07ec269 commit a0c6285
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bkflow/pipeline_plugins/components/collections/http/v1_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from __future__ import absolute_import

import json
import traceback
from copy import deepcopy

Expand Down Expand Up @@ -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"}

Expand Down

0 comments on commit a0c6285

Please sign in to comment.