Skip to content

Commit

Permalink
fix(api): 修复调用request后onHeadersReceived未定义的问题, fix #11224
Browse files Browse the repository at this point in the history
  • Loading branch information
AdvancedCat authored and Chen-jj committed Apr 25, 2022
1 parent 71c900f commit fc2dd98
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/shared/src/native-apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,9 @@ function processApis (taro, global, config: IProcessApisIOptions = {}) {
})

// 给 promise 对象挂载属性
if (key === 'uploadFile' || key === 'downloadFile') {
task && ['abort', 'offHeadersReceived', 'offProgressUpdate', 'onHeadersReceived', 'onProgressUpdate'].forEach(method => {
if (['request', 'uploadFile', 'downloadFile'].includes(key)) {
const taskMethods = ['abort', 'onHeadersReceived', 'offHeadersReceived', 'onProgressUpdate', 'offProgressUpdate', 'onChunkReceived', 'offChunkReceived']
task && taskMethods.forEach(method => {
if (method in task) {
p[method] = task[method].bind(task)
}
Expand Down

0 comments on commit fc2dd98

Please sign in to comment.