Browse Source

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

Valerio Narcisi 10 months ago
parent
commit
af026c5953
2 changed files with 1 additions and 2 deletions
  1. 1 1
      sdks/nodejs-client/index.js
  2. 0 1
      sdks/nodejs-client/index.test.js

+ 1 - 1
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",

+ 0 - 1
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}`,