Comparing version 0.1.0 to 0.1.1
@@ -404,3 +404,3 @@ declare type HeaderValue = string | string[] | number | boolean | null; | ||
interface Download { | ||
(url: string, filePath: string, options: Omit<DownloadRequestOptions, 'filePath'>): DownloadPromise; | ||
(url: string, filePath?: string, options?: Omit<DownloadRequestOptions, 'filePath'>): DownloadPromise; | ||
} | ||
@@ -407,0 +407,0 @@ declare function createDownload(uploadOptions?: Partial<DownloadRequestOptions>): Download; |
@@ -273,3 +273,3 @@ // src/utils/is.ts | ||
function createDownload(uploadOptions = {}) { | ||
return function(url, filePath, options) { | ||
return function(url, filePath, options = {}) { | ||
const _option = deepMerge( | ||
@@ -276,0 +276,0 @@ { url, filePath }, |
{ | ||
"name": "mp-network", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "小程序 网络请求接口二次封装, request/upload/download,适配多个平台", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -111,2 +111,18 @@ # mp-network | ||
**示例6: 请求拦截器** | ||
```js | ||
// 请求体拦截器 | ||
request.interceptor.request.use((config) => { | ||
// do something | ||
// 必须返回 config | ||
return config | ||
}) | ||
request.interceptor.response.use((config) => { | ||
// do something | ||
// 返回处理后的数据 | ||
return config.data | ||
}) | ||
``` | ||
## Methods | ||
@@ -155,2 +171,9 @@ | ||
#### 拦截器 | ||
- `request.interceptor` 拦截器 | ||
- `request.interceptor.request.use(fulfilled, rejected)` 请求体拦截器 | ||
- `request.interceptor.response.use(fulfilled, rejected)` 响应体拦截器 | ||
### upload | ||
@@ -157,0 +180,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42917
361