-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(taro-h5): 响应体无数据时抛错进入reject (#4599)
- Loading branch information
Showing
1 changed file
with
3 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,9 @@ function _request (options) { | |
response.headers.forEach((val, key) => { | ||
res.header[key] = val | ||
}) | ||
if(!response.ok) { | ||
throw response | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
qianzhaoy
|
||
} | ||
if (options.responseType === 'arraybuffer') { | ||
return response.arrayBuffer() | ||
} | ||
|
这里抛出异常会导致非200类 响应无法进入正常处理逻辑,我觉得应该由使用者去处理状态,保持与小程序结果是一致