import Input from "@moduletrace/twui/form/Input"; import Select from "@moduletrace/twui/form/Select"; import CodeEditor from "@/src/components/general/code-editor"; import { CustomToolHttpMethods, type CustomToolHttpMethod } from "@/src/dict/custom-tool-dict"; import type { CustomToolHttpConfig } from "@/src/types"; import parseTemplateLines, { templateLines } from "@/src/utils/parse-template-lines"; import TimeoutField from "./timeout-field"; type Props = { id: string; config: CustomToolHttpConfig; onChange: (config: CustomToolHttpConfig) => void; }; /** * An HTTP tool's request: method, URL, headers and body, all templates. */ export default function HttpToolFields({ id, config, onChange }: Props) { return ( <> onChange({ ...config, url: e.target.value })} /> onChange({ ...config, headers: parseTemplateLines({ text: value, separator: ":" }) }) } /> {config.method == "GET" ? null : ( onChange({ ...config, body: value })} /> )} onChange({ ...config, timeout_ms })} /> ); }