Skip to content

Commit 50df04d

Browse files
authored
Merge pull request #555 from Yongtae723/fix_bug/javascript_command
Refactor API request to include Content-Type header
2 parents 6fca2ea + ed0bbe7 commit 50df04d

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

packages/ui/src/views/chatflows/APICodeDialog.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ output = query({
190190
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
191191
{
192192
method: "POST",
193-
body: data
193+
headers: {
194+
"Content-Type": "application/json"
195+
},
196+
body: JSON.stringify(data)
194197
}
195198
);
196199
const result = await response.json();
@@ -229,9 +232,12 @@ output = query({
229232
const response = await fetch(
230233
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
231234
{
232-
headers: { Authorization: "Bearer ${selectedApiKey?.apiKey}" },
235+
headers: {
236+
Authorization: "Bearer ${selectedApiKey?.apiKey}",
237+
"Content-Type": "application/json"
238+
},
233239
method: "POST",
234-
body: data
240+
body: JSON.stringify(data)
235241
}
236242
);
237243
const result = await response.json();
@@ -392,7 +398,10 @@ output = query({
392398
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
393399
{
394400
method: "POST",
395-
body: data
401+
headers: {
402+
"Content-Type": "application/json"
403+
},
404+
body: JSON.stringify(data)
396405
}
397406
);
398407
const result = await response.json();
@@ -439,9 +448,12 @@ output = query({
439448
const response = await fetch(
440449
"${baseURL}/api/v1/prediction/${dialogProps.chatflowid}",
441450
{
442-
headers: { Authorization: "Bearer ${selectedApiKey?.apiKey}" },
451+
headers: {
452+
Authorization: "Bearer ${selectedApiKey?.apiKey}",
453+
"Content-Type": "application/json"
454+
},
443455
method: "POST",
444-
body: data
456+
body: JSON.stringify(data)
445457
}
446458
);
447459
const result = await response.json();

0 commit comments

Comments
 (0)