utils-uniapp 1.1.11 → 1.1.12
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/lib/http/index.d.ts +26 -15
- package/package.json +1 -1
package/lib/http/index.d.ts
CHANGED
|
@@ -231,18 +231,39 @@ export interface UserRequestOpts {
|
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* 请求config:uni.request配置,排除内部强制覆盖字段,允许业务扩展
|
|
234
|
+
* @note baseURL 为库自定义字段,非uni原生API字段
|
|
234
235
|
*/
|
|
235
|
-
export type HttpRequestConfig = Omit<UniApp.RequestOptions, 'url'|'header'|'method'|'data'|'cancelToken'
|
|
236
|
+
export type HttpRequestConfig = Partial<Omit<UniApp.RequestOptions, 'url' | 'header' | 'method' | 'data' | 'cancelToken'>> & {
|
|
237
|
+
/** 库自定义:请求基础地址,非uni.request原生参数 */
|
|
238
|
+
baseURL?: string;
|
|
239
|
+
/** 库自定义:headers支持对象或者返回对象的工厂函数 */
|
|
240
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
241
|
+
[key: string]: any;
|
|
242
|
+
};
|
|
236
243
|
|
|
237
244
|
/**
|
|
238
245
|
* 上传config:uni.uploadFile配置,排除内部强制覆盖字段
|
|
246
|
+
* @note baseURL 为库自定义字段,非uni.uploadFile原生API字段
|
|
239
247
|
*/
|
|
240
|
-
export type UploadConfig = Omit<UniApp.UploadFileOptions, 'url'|'header'|'filePath'|'name'|'formData'|'cancelToken'
|
|
248
|
+
export type UploadConfig = Partial<Omit<UniApp.UploadFileOptions, 'url' | 'header' | 'filePath' | 'name' | 'formData' | 'cancelToken'>> & {
|
|
249
|
+
/** 库自定义:请求基础地址 */
|
|
250
|
+
baseURL?: string;
|
|
251
|
+
/** 库自定义:headers支持对象或者返回对象的工厂函数 */
|
|
252
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
253
|
+
[key: string]: any;
|
|
254
|
+
};
|
|
241
255
|
|
|
242
256
|
/**
|
|
243
257
|
* 下载config:uni.downloadFile配置,排除内部强制覆盖字段
|
|
258
|
+
* @note baseURL 为库自定义字段,非uni.downloadFile原生API字段
|
|
244
259
|
*/
|
|
245
|
-
export type DownloadConfig = Omit<UniApp.DownloadFileOptions, 'url'|'header'|'cancelToken'
|
|
260
|
+
export type DownloadConfig = Partial<Omit<UniApp.DownloadFileOptions, 'url' | 'header' | 'cancelToken'>> & {
|
|
261
|
+
/** 库自定义:请求基础地址 */
|
|
262
|
+
baseURL?: string;
|
|
263
|
+
/** 库自定义:headers支持对象或者返回对象的工厂函数 */
|
|
264
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
265
|
+
[key: string]: any;
|
|
266
|
+
};
|
|
246
267
|
|
|
247
268
|
/**
|
|
248
269
|
* 请求取消控制器(仿axios CancelToken)
|
|
@@ -369,12 +390,7 @@ export declare function createRequest(defaultConfig: HttpRequestConfig, defaultO
|
|
|
369
390
|
export declare function createUploadFile(
|
|
370
391
|
defaultConfig: UploadConfig,
|
|
371
392
|
defaultOpts?: UserRequestOpts
|
|
372
|
-
): <T = any>(
|
|
373
|
-
url: string,
|
|
374
|
-
params: { filePath: string; keyName?: string; [key: string]: any },
|
|
375
|
-
config?: UploadConfig,
|
|
376
|
-
options?: UserRequestOpts
|
|
377
|
-
) => Promise<T>;
|
|
393
|
+
): <T = any>(url: string, params: { filePath: string; keyName?: string; [key: string]: any }, config?: UploadConfig, options?: UserRequestOpts) => Promise<T>;
|
|
378
394
|
|
|
379
395
|
/**
|
|
380
396
|
* 创建下载文件实例
|
|
@@ -385,12 +401,7 @@ export declare function createUploadFile(
|
|
|
385
401
|
export declare function createDownloadFile(
|
|
386
402
|
defaultConfig: DownloadConfig,
|
|
387
403
|
defaultOpts?: UserRequestOpts
|
|
388
|
-
): <T = any>(
|
|
389
|
-
url: string,
|
|
390
|
-
params?: Record<string, any>,
|
|
391
|
-
config?: DownloadConfig,
|
|
392
|
-
options?: UserRequestOpts
|
|
393
|
-
) => Promise<T>;
|
|
404
|
+
): <T = any>(url: string, params?: Record<string, any>, config?: DownloadConfig, options?: UserRequestOpts) => Promise<T>;
|
|
394
405
|
|
|
395
406
|
export type {
|
|
396
407
|
CacheAdapter,
|