wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
app/components/workflow/nodes/http/components/curl-panel.tsx
@@ -5,7 +5,6 @@
import { BodyType, type HttpNodeType, Method } from '../types'
import Modal from '@/app/components/base/modal'
import Button from '@/app/components/base/button'
import Textarea from '@/app/components/base/textarea'
import Toast from '@/app/components/base/toast'
import { useNodesInteractions } from '@/app/components/workflow/hooks'
@@ -23,14 +22,13 @@
  const node: Partial<HttpNodeType> = {
    title: 'HTTP Request',
    desc: 'Imported from cURL',
    method: undefined,
    method: Method.get,
    url: '',
    headers: '',
    params: '',
    body: { type: BodyType.none, data: '' },
  }
  const args = curlCommand.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || []
  let hasData = false
  for (let i = 1; i < args.length; i++) {
    const arg = args[i].replace(/^['"]|['"]$/g, '')
@@ -40,7 +38,6 @@
        if (i + 1 >= args.length)
          return { node: null, error: 'Missing HTTP method after -X or --request.' }
        node.method = (args[++i].replace(/^['"]|['"]$/g, '') as Method) || Method.get
        hasData = true
        break
      case '-H':
      case '--header':
@@ -92,9 +89,6 @@
    }
  }
  // Determine final method
  node.method = node.method || (hasData ? Method.post : Method.get)
  if (!node.url)
    return { node: null, error: 'Missing URL or url not start with http.' }
@@ -142,9 +136,9 @@
      className='!w-[400px] !max-w-[400px] !p-4'
    >
      <div>
        <Textarea
        <textarea
          value={inputString}
          className='my-3 h-40 w-full grow'
          className='w-full my-3 p-3 text-sm text-gray-900 border-0 rounded-lg grow bg-gray-100 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200 h-40'
          onChange={e => setInputString(e.target.value)}
          placeholder={t('workflow.nodes.http.curl.placeholder')!}
        />