Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12b4b41

Browse files
committed
[Feat] lowcoder-org#1799 add simple examples on curl modal
1 parent 16da9fd commit 12b4b41

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

‎client/packages/lowcoder/src/components/CurlImport.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export function CurlImportModal(props: CurlImportModalProps) {
2424
try {
2525
// Parse the cURL command using the correct import
2626
const parsedData = parseCurl(curlCommand);
27-
console.log("CURL JSON", parsedData)
2827

2928

3029

@@ -72,15 +71,23 @@ export function CurlImportModal(props: CurlImportModalProps) {
7271
Paste cURL Command Here
7372
</div>
7473
<div style={{ marginBottom: 12, color: "#666", fontSize: "12px" }}>
75-
Hint: Try typing in the following curl command and then click on the 'Import' button:
76-
curl -X GET https://mock-api.appsmith.com/users
74+
<div style={{ marginBottom: 4 }}>
75+
<strong>Examples:</strong>
76+
</div>
77+
<div style={{ marginBottom: 2 }}>
78+
GET: <code>curl -X GET https://jsonplaceholder.typicode.com/posts/1</code>
79+
</div>
80+
<div style={{ marginBottom: 2 }}>
81+
POST: <code>curl -X POST https://jsonplaceholder.typicode.com/posts -H "Content-Type: application/json" -d '&#123;"title":"foo","body":"bar","userId":1&#125;'</code>
82+
</div>
83+
<div>
84+
Users: <code>curl -X GET https://jsonplaceholder.typicode.com/users</code>
85+
</div>
7786
</div>
7887
<TextArea
7988
value={curlCommand}
8089
onChange={(e) => setCurlCommand(e.target.value)}
81-
placeholder="curl -X POST \
82-
-H 'Content-Type: application/json' \
83-
'https://generativelanguage.googleapis.com/v1beta/models/{MODEL_ID}:{GENERATE_CONTENT_API}?key={GEMINI_API_KEY}' -d '@request.json'"
90+
placeholder="curl -X GET https://jsonplaceholder.typicode.com/posts/1"
8491
rows={8}
8592
style={{ fontFamily: "monospace" }}
8693
/>

‎client/packages/lowcoder/src/components/ResCreatePanel.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,6 @@ export function ResCreatePanel(props: ResCreateModalProps) {
247247
}, 100);
248248

249249
const handleCurlImportSuccess = (parsedData: any) => {
250-
// For now just log the result as requested
251-
console.log("cURL import successful:", parsedData);
252-
253-
// Create a new REST API query with the parsed data
254-
// We'll pass the parsed data as extra info to be used when creating the query
255250
onSelect(BottomResTypeEnum.Query, {
256251
compType: "restApi",
257252
dataSourceId: QUICK_REST_API_ID,

‎client/packages/lowcoder/src/util/curlUtils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ function parseUrlEncodedData(data: string | object): Array<{ key: string; value:
5656
export function processCurlData(curlData: any) {
5757
if (!curlData) return null;
5858

59-
console.log("Raw cURL data:", curlData); // Debug log
6059

6160
// Convert headers object to key-value array format expected by UI
6261
const headers = curlData.header
@@ -96,7 +95,6 @@ export function processCurlData(curlData: any) {
9695
if (bodyType === "application/x-www-form-urlencoded") {
9796
bodyFormData = parseUrlEncodedData(bodyContent);
9897
processedBody = ""; // Form data goes in bodyFormData, not body
99-
console.log("Parsed form data:", bodyFormData); // Debug log
10098
} else if (typeof bodyContent === "object") {
10199
processedBody = JSON.stringify(bodyContent, null, 2);
102100
} else {

0 commit comments

Comments
 (0)