瀏覽代碼

fix: json in raw text sometimes changed back to key value in HTTP node (#3586)

tags/0.6.4
Joel 1 年之前
父節點
當前提交
ed861ff782
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 5 行新增2 行删除
  1. 5
    2
      web/app/components/workflow/nodes/http/components/edit-body/index.tsx

+ 5
- 2
web/app/components/workflow/nodes/http/components/edit-body/index.tsx 查看文件

// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [onChange]) }, [onChange])


const isCurrentKeyValue = type === BodyType.formData || type === BodyType.xWwwFormUrlencoded

const { const {
list: body, list: body,
setList: setBody, setList: setBody,
addItem: addBody, addItem: addBody,
} = useKeyValueList(payload.data, (value) => { } = useKeyValueList(payload.data, (value) => {
if (!isCurrentKeyValue)
return

const newBody = produce(payload, (draft: Body) => { const newBody = produce(payload, (draft: Body) => {
draft.data = value draft.data = value
}) })
onChange(newBody) onChange(newBody)
}, type === BodyType.json) }, type === BodyType.json)


const isCurrentKeyValue = type === BodyType.formData || type === BodyType.xWwwFormUrlencoded

useEffect(() => { useEffect(() => {
if (!isCurrentKeyValue) if (!isCurrentKeyValue)
return return

Loading…
取消
儲存