Skip to content

Commit

Permalink
Merge pull request #554 from Yongtae723/fix_bug/curl_command
Browse files Browse the repository at this point in the history
add -H "Content-Type: application/json" in curl command
  • Loading branch information
HenryHengZJ authored Jul 18, 2023
2 parents 50df04d + 6804216 commit 8d2b9cc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/ui/src/views/chatflows/APICodeDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ query({"question": "Hey, how are you?"}).then((response) => {
} else if (codeLang === 'cURL') {
return `curl ${baseURL}/api/v1/prediction/${dialogProps.chatflowid} \\
-X POST \\
-d '{"question": "Hey, how are you?"}'`
-d '{"question": "Hey, how are you?"}' \\
-H "Content-Type: application/json"`
}
return ''
}
Expand Down Expand Up @@ -252,6 +253,7 @@ query({"question": "Hey, how are you?"}).then((response) => {
return `curl ${baseURL}/api/v1/prediction/${dialogProps.chatflowid} \\
-X POST \\
-d '{"question": "Hey, how are you?"}' \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer ${selectedApiKey?.apiKey}"`
}
return ''
Expand Down Expand Up @@ -322,7 +324,8 @@ query(formData).then((response) => {
`
} else if (codeLang === 'cURL') {
return `curl ${baseURL}/api/v1/prediction/${dialogProps.chatflowid} \\
-X POST \\${getConfigExamplesForCurl(configData, 'formData')}`
-X POST \\${getConfigExamplesForCurl(configData, 'formData')} \\
-H "Content-Type: multipart/form-data"`
}
return ''
}
Expand Down Expand Up @@ -369,6 +372,7 @@ query(formData).then((response) => {
} else if (codeLang === 'cURL') {
return `curl ${baseURL}/api/v1/prediction/${dialogProps.chatflowid} \\
-X POST \\${getConfigExamplesForCurl(configData, 'formData')} \\
-H "Content-Type: multipart/form-data" \\
-H "Authorization: Bearer ${selectedApiKey?.apiKey}"`
}
return ''
Expand Down Expand Up @@ -419,7 +423,8 @@ query({
} else if (codeLang === 'cURL') {
return `curl ${baseURL}/api/v1/prediction/${dialogProps.chatflowid} \\
-X POST \\
-d '{"question": "Hey, how are you?", "overrideConfig": {${getConfigExamplesForCurl(configData, 'json')}}'`
-d '{"question": "Hey, how are you?", "overrideConfig": {${getConfigExamplesForCurl(configData, 'json')}}' \\
-H "Content-Type: application/json"`
}
return ''
}
Expand Down Expand Up @@ -472,6 +477,7 @@ query({
return `curl ${baseURL}/api/v1/prediction/${dialogProps.chatflowid} \\
-X POST \\
-d '{"question": "Hey, how are you?", "overrideConfig": {${getConfigExamplesForCurl(configData, 'json')}}' \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer ${selectedApiKey?.apiKey}"`
}
return ''
Expand Down

0 comments on commit 8d2b9cc

Please sign in to comment.