浏览代码

`response.json` is a function

JC Brand 2 月之前
父节点
当前提交
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);
         await mock.waitForRoster(_converse, 'all', 0);
 
 
         spyOn(window, 'fetch').and.callFake(() => {
         spyOn(window, 'fetch').and.callFake(() => {
-            const json = [
+            const json = () => [
                 {"jid": "marty@mcfly.net", "fullname": "Marty McFly"},
                 {"jid": "marty@mcfly.net", "fullname": "Marty McFly"},
                 {"jid": "doc@brown.com", "fullname": "Doc Brown"}
                 {"jid": "doc@brown.com", "fullname": "Doc Brown"}
             ];
             ];

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

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