fix: json in raw text sometimes changed back to key value in HTTP node (#3586)
This commit is contained in:
@@ -59,19 +59,22 @@ const EditBody: FC<Props> = ({
|
|||||||
// 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
|
||||||
|
Reference in New Issue
Block a user