소스 검색

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

Valerio Narcisi 11 달 전
부모
커밋
af026c5953
2개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  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}`,