Skip to content

Commit 2a7a393

Browse files
committed
append
1 parent 0255883 commit 2a7a393

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ qiniu.compressImage(file, options).then(data => {
172172
* size: `number` chunk 的尺寸
173173
* loaded: `number` 已经发送完毕的尺寸
174174
* percent: `number` 进度比例,范围在 0 - 100
175-
* isCache?: `boolean` 是否使用的缓存
175+
* fromCache?: `boolean` 是否是来自缓存
176176
* total: 包含 `loaded``total``percent` 三个属性:
177177
* total.loaded: `number`,已上传大小,单位为字节。
178178
* total.total: `number`,本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。

src/errors/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class QiniuRequestError extends QiniuError {
5757
* @description 由于跨域、证书错误、断网、host 解析失败、系统拦截等原因导致的错误
5858
*/
5959
export class QiniuNetworkError extends QiniuRequestError {
60-
constructor(reqId = '', message: string) {
60+
constructor(message: string, reqId = '') {
6161
super(0, reqId, message)
6262
}
6363
}

src/upload/base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export interface InternalConfig {
4949
}
5050

5151
/** 上传任务的配置信息 */
52-
export interface Config extends Omit<InternalConfig, 'upprotocol' | 'uphost'> {
52+
export interface Config extends Partial<Omit<InternalConfig, 'upprotocol' | 'uphost'>> {
5353
/** 上传域名协议 */
54-
upprotocol: InternalConfig['upprotocol'] | 'https:' | 'http:'
54+
upprotocol?: InternalConfig['upprotocol'] | 'https:' | 'http:'
5555
/** 自定义上传域名 */
56-
uphost: InternalConfig['uphost'] | string
56+
uphost?: InternalConfig['uphost'] | string
5757
}
5858

5959
export interface UploadOptions {

src/upload/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function upload(
4343
key: string | null | undefined,
4444
token: string,
4545
putExtra?: Partial<Extra>,
46-
config?: Partial<Config>
46+
config?: Config
4747
): Observable<UploadProgress, QiniuError | QiniuRequestError | QiniuNetworkError, UploadCompleteData> {
4848

4949
// 为每个任务创建单独的 Logger

src/utils/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export function request<T>(url: string, options: RequestOptions): Response<T> {
225225

226226
if (xhr.status === 0) {
227227
// 发生 0 基本都是网络错误,常见的比如跨域、断网、host 解析失败、系统拦截等等
228-
reject(new QiniuNetworkError(reqId, 'network error.'))
228+
reject(new QiniuNetworkError('network error.', reqId))
229229
return
230230
}
231231

0 commit comments

Comments
 (0)