Merge pull request #555 from Yongtae723/fix_bug/javascript_command

Refactor API request to include Content-Type header
This commit is contained in:
Henry Heng 2023-07-18 19:21:43 +01:00 committed by GitHub
commit 50df04d382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 6 deletions

View File

@ -190,7 +190,10 @@ output = query({
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
{
method: "POST",
body: data
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
}
);
const result = await response.json();
@ -229,9 +232,12 @@ output = query({
const response = await fetch(
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
{
headers: { Authorization: "Bearer ${selectedApiKey?.apiKey}" },
headers: {
Authorization: "Bearer ${selectedApiKey?.apiKey}",
"Content-Type": "application/json"
},
method: "POST",
body: data
body: JSON.stringify(data)
}
);
const result = await response.json();
@ -392,7 +398,10 @@ output = query({
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
{
method: "POST",
body: data
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
}
);
const result = await response.json();
@ -439,9 +448,12 @@ output = query({
const response = await fetch(
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
{
headers: { Authorization: "Bearer ${selectedApiKey?.apiKey}" },
headers: {
Authorization: "Bearer ${selectedApiKey?.apiKey}",
"Content-Type": "application/json"
},
method: "POST",
body: data
body: JSON.stringify(data)
}
);
const result = await response.json();