mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 05:15:59 +08:00
fix: import from curl not work for --data (#20471)
This commit is contained in:
parent
8e2d342de6
commit
dd2725be68
@ -2,7 +2,7 @@
|
|||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import React, { useCallback, useState } from 'react'
|
import React, { useCallback, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { BodyType, type HttpNodeType, Method } from '../types'
|
import { BodyPayloadValueType, BodyType, type HttpNodeType, Method } from '../types'
|
||||||
import Modal from '@/app/components/base/modal'
|
import Modal from '@/app/components/base/modal'
|
||||||
import Button from '@/app/components/base/button'
|
import Button from '@/app/components/base/button'
|
||||||
import Textarea from '@/app/components/base/textarea'
|
import Textarea from '@/app/components/base/textarea'
|
||||||
@ -51,11 +51,16 @@ const parseCurl = (curlCommand: string): { node: HttpNodeType | null; error: str
|
|||||||
case '-d':
|
case '-d':
|
||||||
case '--data':
|
case '--data':
|
||||||
case '--data-raw':
|
case '--data-raw':
|
||||||
case '--data-binary':
|
case '--data-binary': {
|
||||||
if (i + 1 >= args.length)
|
if (i + 1 >= args.length)
|
||||||
return { node: null, error: 'Missing data value after -d, --data, --data-raw, or --data-binary.' }
|
return { node: null, error: 'Missing data value after -d, --data, --data-raw, or --data-binary.' }
|
||||||
node.body = { type: BodyType.rawText, data: args[++i].replace(/^['"]|['"]$/g, '') }
|
const bodyPayload = [{
|
||||||
|
type: BodyPayloadValueType.text,
|
||||||
|
value: args[++i].replace(/^['"]|['"]$/g, ''),
|
||||||
|
}]
|
||||||
|
node.body = { type: BodyType.rawText, data: bodyPayload }
|
||||||
break
|
break
|
||||||
|
}
|
||||||
case '-F':
|
case '-F':
|
||||||
case '--form': {
|
case '--form': {
|
||||||
if (i + 1 >= args.length)
|
if (i + 1 >= args.length)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user