diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 60130dd362b3b8797feb457cf4cc70e1b9319420..2e3f62dbcdd757b3e2c8e415b9f7b940ef317943 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -171,4 +171,13 @@ describe('ExtApi-Request', () => { res = await page.data('jest_result'); expect(res).toBe(true) }) + + if(process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('android')){ + it('Check Respone With String Generics', async () => { + res = await page.callMethod('jest_respone_with_string_generics') + 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 ee769e4733bae6a8e248fe225948c6fe27ab7bbd..ed74e5b10096a7ec6be05b48e1786dc57877c6a1 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -301,7 +301,6 @@ firstIpv4: false, success: (res) => { const requestCookie = (res.data as UTSJSONObject).getJSON("data")?.getAny("requestCookie") - console.log("requestCookie ", requestCookie); this.jest_result_data = JSON.stringify(requestCookie) if (requestCookie instanceof Array) { this.jest_result = needCookie ? requestCookie.length > 0 : requestCookie.length == 0 @@ -358,7 +357,6 @@ withCredentials: false, firstIpv4: false, success: (res: RequestSuccess) => { - console.log("success :", res.data?.data); this.jest_result = true; }, fail: () => { @@ -371,7 +369,6 @@ url: 'https://unidemo.dcloud.net.cn/api/news?column=title,author_name,cover,published_at', method: "GET", success: (res : RequestSuccess) => { - console.log(res) if (res.statusCode == 200 && Array.isArray(res.data)) { this.jest_result = true } else { @@ -387,11 +384,9 @@ // #ifdef APP testInovkeRequest({ success:(res: any)=>{ - console.log("success :", res); this.jest_result = true }, fail:(err: any)=>{ - console.log("fail :", err); this.jest_result = false } } as CommonOptions) @@ -401,13 +396,28 @@ uni.request({ url:"https://request.dcloud.net.cn/api/http/contentType/text/json", success:(res: RequestSuccess)=>{ - console.log("res :", res, typeof res.data); this.jest_result = typeof res.data == "object" }, fail:(e: RequestFail)=>{ this.jest_result = false } }) + }, + jest_respone_with_string_generics(){ + uni.request({ + url: this.host + (methodMap['GET'] as string), + method: "GET", + timeout: null, + sslVerify: false, + withCredentials: false, + firstIpv4: false, + success: (res: RequestSuccess) => { + this.jest_result = true; + }, + fail: () => { + this.jest_result = false; + }, + }); } } }