fix(upload): doesn't allow 2xx status code except 200

This commit is contained in:
07akioni 2022-01-04 00:36:07 +08:00
parent a448a720d7
commit 8ceb19dd5a
3 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@
### Fixes
- `n-upload` `on-finish` prop's `event` parameter type should be `ProgressEvent`.
- `n-upload` doesn't allow 2xx status code except 200.
### Feats

View File

@ -5,6 +5,7 @@
### Fixes
- `n-upload` `on-finish` 回调中 `event` 的类型应为 `ProgressEvent`
- `n-upload` 不允许 200 之外的 2xx 响应状态码
### Feats

View File

@ -69,7 +69,7 @@ function createXhrHandlers (
doChange(fileAfterChange, e)
}
function handleXHRLoad (e: ProgressEvent<EventTarget>): void {
if (XHR.status !== 200) {
if (XHR.status < 200 || XHR.status >= 300) {
handleXHRError(e)
return
}