Download web/app/components/workflow/nodes/http/utils.ts from Underground-Digital/Workflow-Engine: direct link, hf CLI and curl.
- Browser
- Download file 500 Bytes
-
https://huggingface.co/spaces/Underground-Digital/Workflow-Engine/resolve/main/web/app/components/workflow/nodes/http/utils.ts
- Command line
-
hf download hf://spaces/Underground-Digital/Workflow-Engine/web/app/components/workflow/nodes/http/utils.ts
-
curl -L -o utils.ts https://huggingface.co/spaces/Underground-Digital/Workflow-Engine/resolve/main/web/app/components/workflow/nodes/http/utils.ts
500 Bytes
| import { type BodyPayload, 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, value] = item.split(':') | |
| return { | |
| key: key || '', | |
| type: BodyPayloadValueType.text, | |
| value: value || '', | |
| } | |
| }) | |
| return bodyPayload | |
| } | |