diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index e383482709300f9ef809b03902706710f635fe4c..2dd94105704213c04ee7bfd112488fe6c8b7483b 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -78,6 +78,12 @@ describe('ExtApi-Request', () => { it('Check HEAD', async () => { await request(page, 'HEAD'); }); + it('Request with timeout null', async () => { + res = await page.callMethod('jest_timeout_null') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }); let shouldTestCookie = false if (process.env.uniTestPlatformInfo.startsWith('android')) { diff --git a/pages/API/request/request.uvue b/pages/API/request/request.uvue index 3d3c80b7f267e34030d2a45624e58fb7a964820d..62637f90f241be5834ef7f2726861f74b1c26e6e 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -285,6 +285,22 @@ }, }); }, + jest_timeout_null() { + uni.request({ + url: this.host + (methodMap['GET'] as string), + method: "GET", + timeout: null, + sslVerify: false, + withCredentials: false, + firstIpv4: false, + success: () => { + this.jest_result = true; + }, + fail: (err) => { + this.jest_result = false; + }, + }); + }, } }