소스 검색

`response.json` is a function

JC Brand 3 달 전
부모
커밋
651ed7874f
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      src/plugins/rosterview/tests/add-contact-modal.js
  2. 1 1
      src/plugins/rosterview/utils.js

+ 1 - 1
src/plugins/rosterview/tests/add-contact-modal.js

@@ -59,7 +59,7 @@ describe("The 'Add Contact' widget", function () {
         await mock.waitForRoster(_converse, 'all', 0);
 
         spyOn(window, 'fetch').and.callFake(() => {
-            const json = [
+            const json = () => [
                 {"jid": "marty@mcfly.net", "fullname": "Marty McFly"},
                 {"jid": "doc@brown.com", "fullname": "Doc Brown"}
             ];

+ 1 - 1
src/plugins/rosterview/utils.js

@@ -317,7 +317,7 @@ export async function getNamesAutoCompleteList(query) {
         return [];
     }
 
-    const json = response.json;
+    const json = response.json();
     if (!Array.isArray(json)) {
         log.error(`Invalid JSON returned"`);
         return [];