Skip to content

Commit

Permalink
fix: request 兼容 useReponse
Browse files Browse the repository at this point in the history
  • Loading branch information
winixt committed May 6, 2024
1 parent 2bc61da commit baf6fe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/fes-plugin-request/package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
4 changes: 3 additions & 1 deletion packages/fes-plugin-request/src/template/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit baf6fe2

Please sign in to comment.