curl create plugin with inputs (#3573)

This commit is contained in:
heheer
2025-01-13 17:37:27 +08:00
committed by GitHub
parent cdf4f0e67d
commit e933dacb05
2 changed files with 86 additions and 18 deletions

View File

@@ -27,12 +27,18 @@ export const parseCurl = (curlContent: string) => {
type: 'string'
}));
const newBody = JSON.stringify(parsed.data, null, 2);
const bodyArray = Object.keys(parsed.data || {}).map((key) => ({
key,
value: parsed.data?.[key],
type: 'string'
}));
return {
url: parsed.url,
method: methodMap[parsed.method?.toLowerCase() as RequestMethod] || 'GET',
params: newParams,
headers: newHeaders,
body: newBody
body: newBody,
bodyArray
};
};