@gopowerteam/request 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -6
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -118,12 +118,14 @@ var _RequestService = class {
|
|
|
118
118
|
plugins.forEach((service) => service.before && service.before(options));
|
|
119
119
|
}
|
|
120
120
|
execResponsePlugin(leftcycle, plugins = [], options, response) {
|
|
121
|
-
plugins.forEach(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
plugins.forEach((plugin) => {
|
|
122
|
+
const leftcycleFn = plugin[leftcycle];
|
|
123
|
+
leftcycleFn && leftcycleFn(response, options);
|
|
124
|
+
});
|
|
125
|
+
_RequestService.config.plugins.forEach((plugin) => {
|
|
126
|
+
const leftcycleFn = plugin[leftcycle];
|
|
127
|
+
leftcycleFn && leftcycleFn(response, options);
|
|
128
|
+
});
|
|
127
129
|
}
|
|
128
130
|
parseRequestPath(path, paramsPath) {
|
|
129
131
|
if (paramsPath) {
|
package/dist/index.d.ts
CHANGED
|
@@ -52,9 +52,9 @@ interface AdapterResponse {
|
|
|
52
52
|
* 请求插件
|
|
53
53
|
*/
|
|
54
54
|
interface RequestPlugin {
|
|
55
|
-
before
|
|
56
|
-
after
|
|
57
|
-
catch
|
|
55
|
+
before?: (options: RequestSendOptions) => void;
|
|
56
|
+
after?: (response: AdapterResponse, options: RequestSendOptions) => void;
|
|
57
|
+
catch?: (response: AdapterResponse, options: RequestSendOptions) => void;
|
|
58
58
|
}
|
|
59
59
|
declare enum PluginLifecycle {
|
|
60
60
|
before = "before",
|
package/dist/index.js
CHANGED
|
@@ -84,12 +84,14 @@ var _RequestService = class {
|
|
|
84
84
|
plugins.forEach((service) => service.before && service.before(options));
|
|
85
85
|
}
|
|
86
86
|
execResponsePlugin(leftcycle, plugins = [], options, response) {
|
|
87
|
-
plugins.forEach(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
plugins.forEach((plugin) => {
|
|
88
|
+
const leftcycleFn = plugin[leftcycle];
|
|
89
|
+
leftcycleFn && leftcycleFn(response, options);
|
|
90
|
+
});
|
|
91
|
+
_RequestService.config.plugins.forEach((plugin) => {
|
|
92
|
+
const leftcycleFn = plugin[leftcycle];
|
|
93
|
+
leftcycleFn && leftcycleFn(response, options);
|
|
94
|
+
});
|
|
93
95
|
}
|
|
94
96
|
parseRequestPath(path, paramsPath) {
|
|
95
97
|
if (paramsPath) {
|