Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: node.js sdk if request is a get data must not exist (#4618)

Valerio Narcisiaf026c59535b
diff --git a/sdks/nodejs-client/index.js b/sdks/nodejs-client/index.js
index 127d62cf870..93491fa16b7 100644
--- a/sdks/nodejs-client/index.js
+++ b/sdks/nodejs-client/index.js
@@ -85,7 +85,7 @@ export class DifyClient {
response = await axios({
method,
url,
- data,
+ ...(method !== "GET" && { data }),
params,
headers,
responseType: "json",
diff --git a/sdks/nodejs-client/index.test.js b/sdks/nodejs-client/index.test.js
index e08b8e82af5..f300b16fc9a 100644
--- a/sdks/nodejs-client/index.test.js
+++ b/sdks/nodejs-client/index.test.js
@@ -42,7 +42,6 @@ describe('Send Requests', () => {
expect(axios).toHaveBeenCalledWith({
method,
url: `${BASE_URL}${endpoint}`,
- data: null,
params: null,
headers: {
Authorization: `Bearer ${difyClient.apiKey}`,