From dae62bef7835c5c7ece0f60b097dce19e00fc4c5 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 29 Aug 2024 11:55:18 +0800 Subject: [PATCH] fix: change to key value type not show init key values --- .../nodes/http/components/edit-body/index.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx index 301ab81c92..6441f8f8e5 100644 --- a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx +++ b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx @@ -63,9 +63,19 @@ const EditBody: FC = ({ const handleTypeChange = useCallback((e: React.ChangeEvent) => { const newType = e.target.value as BodyType + const hasKeyValue = [BodyType.formData, BodyType.xWwwFormUrlencoded].includes(newType) onChange({ type: newType, - data: [], + data: hasKeyValue + ? [ + { + id: uniqueId(UNIQUE_ID_PREFIX), + type: BodyPayloadValueType.text, + key: '', + value: '', + }, + ] + : [], }) }, [onChange])