From 284984a66686b27cf527b7ffb4bddbb8d2c6d9e3 Mon Sep 17 00:00:00 2001 From: taohebin Date: Tue, 16 Jul 2024 10:28:27 +0800 Subject: [PATCH] =?UTF-8?q?test:=20request=E5=A2=9E=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/request/request.test.js | 7 +++++++ pages/API/request/request.uvue | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 0b709f9d..60130dd3 100644 --- a/pages/API/request/request.test.js +++ b/pages/API/request/request.test.js @@ -164,4 +164,11 @@ describe('ExtApi-Request', () => { expect(res).toBe(true) }) } + + it('Check Respone Json String', async () => { + res = await page.callMethod('jest_respone_json_string') + 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 65b26d92..ee769e47 100644 --- a/pages/API/request/request.uvue +++ b/pages/API/request/request.uvue @@ -396,6 +396,18 @@ } } as CommonOptions) // #endif + }, + jest_respone_json_string(){ + 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 + } + }) } } } -- GitLab