dify/web/app/components/workflow/nodes/http/utils.ts
mengnanjiugaipeifense e2bc8f2c17
fix: keep colons in HTTP node form body values on migration (#38861)
Co-authored-by: xiaweiwei67-stack <293320877+xiaweiwei67-stack@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-03 08:39:04 +00:00

23 lines
534 B
TypeScript

import type { BodyPayload } from './types'
import { BodyPayloadValueType } from './types'
export const transformToBodyPayload = (old: string, hasKey: boolean): BodyPayload => {
if (!hasKey) {
return [
{
type: BodyPayloadValueType.text,
value: old,
},
]
}
const bodyPayload = old.split('\n').map((item) => {
const [key, ...others] = item.split(':')
return {
key: key || '',
type: BodyPayloadValueType.text,
value: others.join(':'),
}
})
return bodyPayload
}