diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 2dd94105704213c04ee7bfd112488fe6c8b7483b..9d772378a3ca2bc2b0028666e0d32250059a311d 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -107,5 +107,11 @@ describe('ExtApi-Request', () => { await page.waitFor(2000); res = await page.data('jest_result'); expect(res).toBe(true) - }); + }); + it('Check Get With Data', async () => { + res = await page.callMethod('jest_get_with_data') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }) }); diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue index bc33bda1d8346cca49a9b31a16a3fe8dfde5ab28..8890befdb4f0880365eeb4f006b7e6e05b8cda0a 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -300,6 +300,25 @@ this.jest_result = false; }, }); + }, + jest_get_with_data() { + uni.request({ + url: "https://unidemo.dcloud.net.cn/api/banner/36kr", + method: "GET", + data:{ + column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名 + }, + timeout: 6000, + sslVerify: false, + withCredentials: false, + firstIpv4: false, + success: () => { + this.jest_result = true; + }, + fail: () => { + this.jest_result = false; + }, + }); }, } }