From 516c0fbe48fae401bc724f9bb1f52426c380759d Mon Sep 17 00:00:00 2001 From: winixt Date: Mon, 6 May 2024 18:08:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20request=20=E5=85=BC=E5=AE=B9=20useRepons?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-request/package.json | 2 +- packages/fes-plugin-request/src/template/request.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/fes-plugin-request/package.json b/packages/fes-plugin-request/package.json index ef5f8b67..bdd162b1 100644 --- a/packages/fes-plugin-request/package.json +++ b/packages/fes-plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-request", - "version": "3.0.7", + "version": "3.0.8", "description": "@fesjs/plugin-request", "main": "lib/index.js", "files": [ diff --git a/packages/fes-plugin-request/src/template/request.js b/packages/fes-plugin-request/src/template/request.js index db7c4ce8..7fbbb902 100644 --- a/packages/fes-plugin-request/src/template/request.js +++ b/packages/fes-plugin-request/src/template/request.js @@ -154,7 +154,9 @@ const _request = (url, data, options, onSuccess) => { if (onSuccess) { return onSuccess(await dataHandler(context.response.data, context.response), context); } - return dataHandler(context.response.data, context.response); + context.response.data = await dataHandler(context.response.data, context.response); + // 兼容以前的 useResponse 属性 + return context.config.useResponse ? context.response : context.response.data; } errorHandler && errorHandler(context.error); return Promise.reject(context.error);