diff --git a/pages/API/request/request.test.js b/pages/API/request/request.test.js index 0b709f9d696b8a86f20cdf6bbb4ccd26b3149c43..60130dd362b3b8797feb457cf4cc70e1b9319420 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 65b26d92ab8cf3b0fbcbb50a41cd5f7381e32bc6..ee769e4733bae6a8e248fe225948c6fe27ab7bbd 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 + } + }) } } }