@uni-helper/axios-adapter 1.5.3 → 1.16.0

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.js CHANGED
@@ -1,350 +1,315 @@
1
- import { Axios, AxiosHeaders, AxiosError, CanceledError } from 'axios';
2
- import buildURL from 'axios/unsafe/helpers/buildURL';
3
- import speedometer from 'axios/unsafe/helpers/speedometer';
4
- import buildFullPath from 'axios/unsafe/core/buildFullPath';
5
- import settle from 'axios/unsafe/core/settle';
6
-
7
- // src/index.ts
1
+ import { Axios, AxiosError, AxiosHeaders, CanceledError } from "axios";
2
+ import buildFullPath from "axios/unsafe/core/buildFullPath";
3
+ import buildURL from "axios/unsafe/helpers/buildURL";
4
+ import speedometer from "axios/unsafe/helpers/speedometer";
5
+ import settle from "axios/unsafe/core/settle";
6
+ //#region src/utils.ts
8
7
  function getMethodType(config) {
9
- const { method: rawMethod = "GET" } = config;
10
- const method = rawMethod.toLocaleLowerCase();
11
- switch (method) {
12
- case "download":
13
- return "download";
14
- case "upload":
15
- return "upload";
16
- default:
17
- return "request";
18
- }
8
+ const { method: rawMethod = "GET" } = config;
9
+ switch (rawMethod.toLocaleLowerCase()) {
10
+ case "download": return "download";
11
+ case "upload": return "upload";
12
+ default: return "request";
13
+ }
19
14
  }
20
15
  function resolveOptions(userOptions) {
21
- return {
22
- ...userOptions
23
- };
16
+ return { ...userOptions };
24
17
  }
25
18
  function resolveUniAppRequestOptions(config, _options) {
26
- var _a, _b;
27
- const data = config.data;
28
- const responseType = config.responseType === "arraybuffer" ? "arraybuffer" : "text";
29
- const dataType = responseType === "text" ? "json" : void 0;
30
- const { headers, baseURL, ...requestConfig } = config;
31
- const requestHeaders = AxiosHeaders.from(serializeObject(headers)).normalize(false);
32
- if (config.auth) {
33
- const username = config.auth.username || "";
34
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
35
- requestHeaders.set(
36
- "Authorization",
37
- `Basic ${btoa(`${username}:${password}`)}`
38
- );
39
- }
40
- const fullPath = buildFullPath(baseURL, config.url);
41
- const method = (_b = (_a = config == null ? void 0 : config.method) == null ? void 0 : _a.toUpperCase()) != null ? _b : "GET";
42
- const url = buildURL(fullPath, config.params, config.paramsSerializer);
43
- const timeout = config.timeout || 6e4;
44
- let formData = {};
45
- if (data && typeof data === "string") {
46
- try {
47
- formData = JSON.parse(data);
48
- } catch (error) {
49
- }
50
- }
51
- const header = requestHeaders.toJSON();
52
- return {
53
- ...requestConfig,
54
- url,
55
- data,
56
- header,
57
- method,
58
- responseType,
59
- dataType,
60
- timeout,
61
- formData
62
- };
19
+ const data = config.data;
20
+ const responseType = config.responseType === "arraybuffer" ? "arraybuffer" : "text";
21
+ const dataType = responseType === "text" ? "json" : void 0;
22
+ const { headers, baseURL, ...requestConfig } = config;
23
+ const requestHeaders = AxiosHeaders.from(serializeObject(headers)).normalize(false);
24
+ if (config.auth) {
25
+ const username = config.auth.username || "";
26
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
27
+ requestHeaders.set("Authorization", `Basic ${btoa(`${username}:${password}`)}`);
28
+ }
29
+ const fullPath = buildFullPath(baseURL, config.url);
30
+ const method = config?.method?.toUpperCase() ?? "GET";
31
+ const url = buildURL(fullPath, config.params, config.paramsSerializer);
32
+ const timeout = config.timeout || 6e4;
33
+ let formData = {};
34
+ if (data && typeof data === "string") try {
35
+ formData = JSON.parse(data);
36
+ } catch {}
37
+ const header = requestHeaders.toJSON();
38
+ return {
39
+ ...requestConfig,
40
+ url,
41
+ data,
42
+ header,
43
+ method,
44
+ responseType,
45
+ dataType,
46
+ timeout,
47
+ formData
48
+ };
63
49
  }
64
50
  function progressEventReducer(listener, isDownloadStream) {
65
- let bytesNotified = 0;
66
- const _speedometer = speedometer(50, 250);
67
- return (result) => {
68
- const loaded = result.totalBytesWritten;
69
- const total = result.totalBytesExpectedToWrite;
70
- const progressBytes = loaded - bytesNotified;
71
- const rate = _speedometer(progressBytes);
72
- const inRange = loaded <= total;
73
- bytesNotified = loaded;
74
- const data = {
75
- loaded,
76
- total,
77
- progress: total ? loaded / total : void 0,
78
- bytes: progressBytes,
79
- rate: rate || void 0,
80
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
81
- event: result
82
- };
83
- data[isDownloadStream ? "download" : "upload"] = true;
84
- listener(data);
85
- };
51
+ let bytesNotified = 0;
52
+ const _speedometer = speedometer(50, 250);
53
+ return (result) => {
54
+ const loaded = result.totalBytesWritten;
55
+ const total = result.totalBytesExpectedToWrite;
56
+ const progressBytes = loaded - bytesNotified;
57
+ const rate = _speedometer(progressBytes);
58
+ const inRange = loaded <= total;
59
+ bytesNotified = loaded;
60
+ const data = {
61
+ loaded,
62
+ total,
63
+ progress: total ? loaded / total : void 0,
64
+ bytes: progressBytes,
65
+ rate: rate || void 0,
66
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
67
+ event: result
68
+ };
69
+ data[isDownloadStream ? "download" : "upload"] = true;
70
+ listener(data);
71
+ };
86
72
  }
73
+ /**
74
+ * ### 对象序列化
75
+ * - 将一个对象序列化为一个纯净的、类似JSON的新对象。
76
+ * - 此过程会过滤掉值为 null、undefined 或 false 的属性。
77
+ *
78
+ * @link https://github.com/axios/axios/blob/ef36347fb559383b04c755b07f1a8d11897fab7f/lib/core/AxiosHeaders.js#L238-L246
79
+ * @param {Record<string, any> | null | undefined} sourceObj 要进行序列化的源对象。
80
+ * @param {SerializeOptions} [options] 序列化选项。
81
+ * @returns {Record<string, any>} 返回一个新的、纯净的 JavaScript 对象。
82
+ */
87
83
  function serializeObject(sourceObj, options) {
88
- const resultObj = /* @__PURE__ */ Object.create(null);
89
- if (!sourceObj)
90
- return resultObj;
91
- const { asStrings = false } = options || {};
92
- forEach(sourceObj, (value, key) => {
93
- if (value != null && value !== false) {
94
- resultObj[key] = asStrings && Array.isArray(value) ? value.join(", ") : value;
95
- }
96
- });
97
- return resultObj;
84
+ const resultObj = Object.create(null);
85
+ if (!sourceObj) return resultObj;
86
+ const { asStrings = false } = options || {};
87
+ forEach(sourceObj, (value, key) => {
88
+ if (value != null && value !== false) resultObj[key] = asStrings && Array.isArray(value) ? value.join(", ") : value;
89
+ });
90
+ return resultObj;
98
91
  }
92
+ /**
93
+ * Iterate over an Array or an Object invoking a function for each item.
94
+ *
95
+ * If `obj` is an Array callback will be called passing
96
+ * the value, index, and complete array for each item.
97
+ *
98
+ * If 'obj' is an Object callback will be called passing
99
+ * the value, key, and complete object for each property.
100
+ *
101
+ * @link https://github.com/axios/axios/blob/v1.x/lib/utils.js#L240
102
+ *
103
+ * @param {object | Array} obj The object to iterate
104
+ * @param {Function} fn The callback to invoke for each item
105
+ * @param {object} [options]
106
+ * @param {boolean} [options.allOwnKeys]
107
+ */
99
108
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
100
- if (obj === null || typeof obj === "undefined")
101
- return;
102
- if (typeof obj !== "object")
103
- obj = [obj];
104
- if (Array.isArray(obj)) {
105
- for (let i = 0, l = obj.length; i < l; i++) {
106
- fn(obj[i], i, obj);
107
- }
108
- } else {
109
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
110
- const len = keys.length;
111
- let key;
112
- for (let i = 0; i < len; i++) {
113
- key = keys[i];
114
- fn(obj[key], key, obj);
115
- }
116
- }
109
+ if (obj === null || typeof obj === "undefined") return;
110
+ if (typeof obj !== "object") obj = [obj];
111
+ if (Array.isArray(obj)) for (let i = 0, l = obj.length; i < l; i++) fn(obj[i], i, obj);
112
+ else {
113
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
114
+ const len = keys.length;
115
+ let key;
116
+ for (let i = 0; i < len; i++) {
117
+ key = keys[i];
118
+ fn(obj[key], key, obj);
119
+ }
120
+ }
117
121
  }
122
+ //#endregion
123
+ //#region src/methods/onCanceled.ts
118
124
  var OnCanceled = class {
119
- constructor(config) {
120
- this.config = config;
121
- }
122
- subscribe(task, reject) {
123
- if (this.config.cancelToken || this.config.signal) {
124
- this.onCanceled = (cancel) => {
125
- if (!task)
126
- return;
127
- reject(
128
- !cancel || cancel.type ? new CanceledError(void 0, void 0, this.config, task) : cancel
129
- );
130
- task.abort();
131
- task = null;
132
- };
133
- if (this.config.cancelToken) {
134
- this.config.cancelToken.subscribe(this.onCanceled);
135
- }
136
- if (this.config.signal && this.config.signal.addEventListener) {
137
- this.config.signal.aborted ? this.onCanceled() : this.config.signal.addEventListener("abort", this.onCanceled);
138
- }
139
- }
140
- }
141
- unsubscribe() {
142
- if (this.config.cancelToken) {
143
- this.config.cancelToken.unsubscribe(this.onCanceled);
144
- }
145
- if (this.config.signal && this.config.signal.removeEventListener)
146
- this.config.signal.removeEventListener("abort", this.onCanceled);
147
- }
125
+ config;
126
+ onCanceled;
127
+ constructor(config) {
128
+ this.config = config;
129
+ }
130
+ subscribe(task, reject) {
131
+ if (this.config.cancelToken || this.config.signal) {
132
+ this.onCanceled = (cancel) => {
133
+ if (!task) return;
134
+ reject(!cancel || cancel.type ? new CanceledError(void 0, void 0, this.config, task) : cancel);
135
+ task.abort();
136
+ task = null;
137
+ };
138
+ if (this.config.cancelToken) this.config.cancelToken.subscribe(this.onCanceled);
139
+ if (this.config.signal && this.config.signal.addEventListener) this.config.signal.aborted ? this.onCanceled() : this.config.signal.addEventListener("abort", this.onCanceled);
140
+ }
141
+ }
142
+ unsubscribe() {
143
+ if (this.config.cancelToken) this.config.cancelToken.unsubscribe(this.onCanceled);
144
+ if (this.config.signal && this.config.signal.removeEventListener) this.config.signal.removeEventListener("abort", this.onCanceled);
145
+ }
148
146
  };
149
-
150
- // src/methods/download.ts
151
- var download = (config, options) => {
152
- return new Promise((resolve, reject) => {
153
- const requestOptions = resolveUniAppRequestOptions(
154
- config);
155
- const responseConfig = config;
156
- responseConfig.headers = new AxiosHeaders(requestOptions.header);
157
- const onCanceled = new OnCanceled(config);
158
- let task = uni.downloadFile({
159
- ...requestOptions,
160
- success(result) {
161
- var _a;
162
- if (!task)
163
- return;
164
- const response = {
165
- config: responseConfig,
166
- data: result.tempFilePath,
167
- headers: {},
168
- status: result.statusCode,
169
- statusText: (_a = result.errMsg) != null ? _a : "OK",
170
- request: task
171
- };
172
- settle(resolve, reject, response);
173
- task = null;
174
- },
175
- fail(error) {
176
- const { errMsg = "" } = error != null ? error : {};
177
- if (errMsg) {
178
- const isTimeoutError = errMsg === "downloadFile:fail timeout";
179
- if (isTimeoutError)
180
- reject(new AxiosError(errMsg, AxiosError.ETIMEDOUT, responseConfig, task));
181
- const isNetworkError = errMsg === "downloadFile:fail";
182
- if (isNetworkError) {
183
- reject(
184
- new AxiosError(errMsg, AxiosError.ERR_NETWORK, responseConfig, task)
185
- );
186
- }
187
- }
188
- reject(new AxiosError(error.errMsg, void 0, responseConfig, task));
189
- task = null;
190
- },
191
- complete() {
192
- onCanceled.unsubscribe();
193
- }
194
- });
195
- if (typeof config.onDownloadProgress === "function") {
196
- task.onProgressUpdate(
197
- progressEventReducer(config.onDownloadProgress, true)
198
- );
199
- }
200
- if (typeof config.onHeadersReceived === "function")
201
- task.onHeadersReceived(config.onHeadersReceived);
202
- onCanceled.subscribe(task, reject);
203
- });
147
+ //#endregion
148
+ //#region src/methods/download.ts
149
+ const download = (config, options) => {
150
+ return new Promise((resolve, reject) => {
151
+ const requestOptions = resolveUniAppRequestOptions(config, options);
152
+ const responseConfig = config;
153
+ responseConfig.headers = new AxiosHeaders(requestOptions.header);
154
+ const onCanceled = new OnCanceled(config);
155
+ let task = uni.downloadFile({
156
+ ...requestOptions,
157
+ success(result) {
158
+ if (!task) return;
159
+ settle(resolve, reject, {
160
+ config: responseConfig,
161
+ data: result.tempFilePath,
162
+ headers: {},
163
+ status: result.statusCode,
164
+ statusText: result.errMsg ?? "OK",
165
+ request: task
166
+ });
167
+ task = null;
168
+ },
169
+ fail(error) {
170
+ const { errMsg = "" } = error ?? {};
171
+ if (errMsg) {
172
+ if (errMsg === "downloadFile:fail timeout") reject(new AxiosError(errMsg, AxiosError.ETIMEDOUT, responseConfig, task));
173
+ if (errMsg === "downloadFile:fail") reject(new AxiosError(errMsg, AxiosError.ERR_NETWORK, responseConfig, task));
174
+ }
175
+ reject(new AxiosError(error.errMsg, void 0, responseConfig, task));
176
+ task = null;
177
+ },
178
+ complete() {
179
+ onCanceled.unsubscribe();
180
+ }
181
+ });
182
+ if (typeof config.onDownloadProgress === "function") task.onProgressUpdate(progressEventReducer(config.onDownloadProgress, true));
183
+ if (typeof config.onHeadersReceived === "function") task.onHeadersReceived(config.onHeadersReceived);
184
+ onCanceled.subscribe(task, reject);
185
+ });
204
186
  };
205
- var download_default = download;
206
- var upload = (config, options) => {
207
- return new Promise((resolve, reject) => {
208
- const requestOptions = resolveUniAppRequestOptions(config);
209
- const responseConfig = config;
210
- responseConfig.headers = new AxiosHeaders(requestOptions.header);
211
- const onCanceled = new OnCanceled(config);
212
- let task = uni.uploadFile({
213
- ...requestOptions,
214
- success(result) {
215
- var _a;
216
- if (!task)
217
- return;
218
- const response = {
219
- config: responseConfig,
220
- data: result.data,
221
- headers: {},
222
- status: result.statusCode,
223
- statusText: (_a = result.errMsg) != null ? _a : "OK",
224
- request: task
225
- };
226
- settle(resolve, reject, response);
227
- task = null;
228
- },
229
- fail(error) {
230
- const { errMsg = "" } = error != null ? error : {};
231
- if (errMsg) {
232
- const isTimeoutError = errMsg === "uploadFile:fail timeout";
233
- const isNetworkError = errMsg === "uploadFile:fail file error";
234
- if (isTimeoutError)
235
- reject(new AxiosError(errMsg, AxiosError.ETIMEDOUT, responseConfig, task));
236
- if (isNetworkError) {
237
- reject(
238
- new AxiosError(errMsg, AxiosError.ERR_NETWORK, responseConfig, task)
239
- );
240
- }
241
- }
242
- reject(new AxiosError(error.errMsg, void 0, responseConfig, task));
243
- task = null;
244
- },
245
- complete() {
246
- onCanceled.unsubscribe();
247
- }
248
- });
249
- if (typeof config.onHeadersReceived === "function")
250
- task.onHeadersReceived(config.onHeadersReceived);
251
- onCanceled.subscribe(task, reject);
252
- });
187
+ //#endregion
188
+ //#region src/methods/request.ts
189
+ const request = (config, options) => {
190
+ return new Promise((resolve, reject) => {
191
+ const requestOptions = resolveUniAppRequestOptions(config, options);
192
+ const responseConfig = config;
193
+ responseConfig.headers = new AxiosHeaders(requestOptions.header);
194
+ const onCanceled = new OnCanceled(config);
195
+ let task = uni.request({
196
+ ...requestOptions,
197
+ success(result) {
198
+ if (!task) return;
199
+ if (Array.isArray(result.header)) {
200
+ const dingHeader = {};
201
+ result.header.forEach((h) => Object.assign(dingHeader, h));
202
+ result.header = dingHeader;
203
+ }
204
+ const headers = new AxiosHeaders(result.header);
205
+ settle(resolve, reject, {
206
+ config: responseConfig,
207
+ data: result.data,
208
+ headers,
209
+ status: result.statusCode,
210
+ statusText: result.errMsg ?? "OK",
211
+ request: task,
212
+ cookies: result.cookies
213
+ });
214
+ task = null;
215
+ },
216
+ fail(error) {
217
+ const { errMsg = "" } = error ?? {};
218
+ if (errMsg) {
219
+ const isStatusError = errMsg === "request:fail http status error";
220
+ const isTimeoutError = errMsg === "request:fail timeout";
221
+ const isNetworkError = errMsg === "request:fail";
222
+ if (isTimeoutError) reject(new AxiosError(errMsg, AxiosError.ETIMEDOUT, responseConfig, task));
223
+ if (isNetworkError) reject(new AxiosError(errMsg, AxiosError.ERR_NETWORK, responseConfig, task));
224
+ if (isStatusError) {
225
+ const response = error ?? {};
226
+ reject(new AxiosError(errMsg, response.statusCode, responseConfig, task, response));
227
+ }
228
+ }
229
+ reject(new AxiosError(error.errMsg, void 0, responseConfig, task));
230
+ task = null;
231
+ },
232
+ complete() {
233
+ onCanceled.unsubscribe();
234
+ }
235
+ });
236
+ if (typeof config.onHeadersReceived === "function") task.onHeadersReceived(config.onHeadersReceived);
237
+ onCanceled.subscribe(task, reject);
238
+ });
253
239
  };
254
- var upload_default = upload;
255
- var request = (config, options) => {
256
- return new Promise((resolve, reject) => {
257
- const requestOptions = resolveUniAppRequestOptions(config);
258
- const responseConfig = config;
259
- responseConfig.headers = new AxiosHeaders(requestOptions.header);
260
- const onCanceled = new OnCanceled(config);
261
- let task = uni.request({
262
- ...requestOptions,
263
- success(result) {
264
- var _a;
265
- if (!task)
266
- return;
267
- if (Array.isArray(result.header)) {
268
- const dingHeader = {};
269
- result.header.forEach((h) => Object.assign(dingHeader, h));
270
- result.header = dingHeader;
271
- }
272
- const headers = new AxiosHeaders(result.header);
273
- const response = {
274
- config: responseConfig,
275
- data: result.data,
276
- headers,
277
- status: result.statusCode,
278
- statusText: (_a = result.errMsg) != null ? _a : "OK",
279
- request: task,
280
- cookies: result.cookies
281
- };
282
- settle(resolve, reject, response);
283
- task = null;
284
- },
285
- fail(error) {
286
- const { errMsg = "" } = error != null ? error : {};
287
- if (errMsg) {
288
- const isTimeoutError = errMsg === "request:fail timeout";
289
- const isNetworkError = errMsg === "request:fail";
290
- if (isTimeoutError)
291
- reject(new AxiosError(errMsg, AxiosError.ETIMEDOUT, responseConfig, task));
292
- if (isNetworkError) {
293
- reject(
294
- new AxiosError(errMsg, AxiosError.ERR_NETWORK, responseConfig, task)
295
- );
296
- }
297
- }
298
- reject(new AxiosError(error.errMsg, void 0, responseConfig, task));
299
- task = null;
300
- },
301
- complete() {
302
- onCanceled.unsubscribe();
303
- }
304
- });
305
- if (typeof config.onHeadersReceived === "function")
306
- task.onHeadersReceived(config.onHeadersReceived);
307
- onCanceled.subscribe(task, reject);
308
- });
240
+ //#endregion
241
+ //#region src/methods/upload.ts
242
+ const upload = (config, options) => {
243
+ return new Promise((resolve, reject) => {
244
+ const requestOptions = resolveUniAppRequestOptions(config, options);
245
+ const responseConfig = config;
246
+ responseConfig.headers = new AxiosHeaders(requestOptions.header);
247
+ const onCanceled = new OnCanceled(config);
248
+ let task = uni.uploadFile({
249
+ ...requestOptions,
250
+ success(result) {
251
+ if (!task) return;
252
+ settle(resolve, reject, {
253
+ config: responseConfig,
254
+ data: result.data,
255
+ headers: {},
256
+ status: result.statusCode,
257
+ statusText: result.errMsg ?? "OK",
258
+ request: task
259
+ });
260
+ task = null;
261
+ },
262
+ fail(error) {
263
+ const { errMsg = "" } = error ?? {};
264
+ if (errMsg) {
265
+ const isTimeoutError = errMsg === "uploadFile:fail timeout";
266
+ const isNetworkError = errMsg === "uploadFile:fail file error";
267
+ if (isTimeoutError) reject(new AxiosError(errMsg, AxiosError.ETIMEDOUT, responseConfig, task));
268
+ if (isNetworkError) reject(new AxiosError(errMsg, AxiosError.ERR_NETWORK, responseConfig, task));
269
+ }
270
+ reject(new AxiosError(error.errMsg, void 0, responseConfig, task));
271
+ task = null;
272
+ },
273
+ complete() {
274
+ onCanceled.unsubscribe();
275
+ }
276
+ });
277
+ if (typeof config.onHeadersReceived === "function") task.onHeadersReceived(config.onHeadersReceived);
278
+ onCanceled.subscribe(task, reject);
279
+ });
309
280
  };
310
- var request_default = request;
311
-
312
- // src/methods/index.ts
281
+ //#endregion
282
+ //#region src/methods/index.ts
313
283
  function getMethod(config) {
314
- const methodType = getMethodType(config);
315
- switch (methodType) {
316
- case "download":
317
- return download_default;
318
- case "upload":
319
- return upload_default;
320
- default:
321
- return request_default;
322
- }
284
+ switch (getMethodType(config)) {
285
+ case "download": return download;
286
+ case "upload": return upload;
287
+ default: return request;
288
+ }
323
289
  }
324
-
325
- // src/index.ts
290
+ //#endregion
291
+ //#region src/index.ts
326
292
  function createUniAppAxiosAdapter(userOptions = {}) {
327
- const options = resolveOptions(userOptions);
328
- Axios.prototype.download = function(url, config) {
329
- return this.request({
330
- url,
331
- method: "download",
332
- ...config
333
- });
334
- };
335
- Axios.prototype.upload = function(url, data, config) {
336
- return this.request({
337
- url,
338
- method: "upload",
339
- data,
340
- ...config
341
- });
342
- };
343
- const uniappAdapter = (config) => {
344
- const method = getMethod(config);
345
- return method(config, options);
346
- };
347
- return uniappAdapter;
293
+ const options = resolveOptions(userOptions);
294
+ Axios.prototype.download = function(url, config) {
295
+ return this.request({
296
+ url,
297
+ method: "download",
298
+ ...config
299
+ });
300
+ };
301
+ Axios.prototype.upload = function(url, data, config) {
302
+ return this.request({
303
+ url,
304
+ method: "upload",
305
+ data,
306
+ ...config
307
+ });
308
+ };
309
+ const uniappAdapter = (config) => {
310
+ return getMethod(config)(config, options);
311
+ };
312
+ return uniappAdapter;
348
313
  }
349
-
314
+ //#endregion
350
315
  export { createUniAppAxiosAdapter };
@@ -0,0 +1,7 @@
1
+ //#region src/types.d.ts
2
+ interface Options {}
3
+ interface UserOptions extends Partial<Options> {}
4
+ interface UnpluginOptions {}
5
+ interface UserUnpluginOptions extends Partial<UnpluginOptions> {}
6
+ //#endregion
7
+ export { UserUnpluginOptions as n, UserOptions as t };