diff --git a/packages/fes-plugin-request/src/template/request.js b/packages/fes-plugin-request/src/template/request.js index c98683ad..214173c2 100644 --- a/packages/fes-plugin-request/src/template/request.js +++ b/packages/fes-plugin-request/src/template/request.js @@ -15,7 +15,7 @@ function getRequestInstance() { return createRequest(defaultConfig); } -const currentRequest = getRequestInstance(); +let currentRequest; export const rawRequest = (url, data, options = {}) => { if (typeof options === 'string') { @@ -23,6 +23,9 @@ export const rawRequest = (url, data, options = {}) => { method: options, }; } + if (!currentRequest) { + currentRequest = getRequestInstance(); + } return currentRequest(url, data, options); };