HarmonyOS rcp通过fetch发送request form表单上传文件,上传进度onUploadProgress 相同进度重复回调

const r_config: cp.Configuration = {
  tracing: {
    httpEventsHandler: {
      onUploadProgress:(total,process)=>{
        console.log(`` RCP ` Upload Progress: ${total} ${process}`)
      }
    }
  }
};

//构建request 其他参数忽略
const request = new rcp.Request(
  r_url,
  r_method,
  r_header,
  r_content,
  r_cookies,
  r_transferRange,
  r_config);
}

await this.rcpSession.fetch(request)

如下log

` RCP ` Upload Progress: 570681 40544
` RCP ` Upload Progress: 570681 65536
` RCP ` Upload Progress: 570681 65536
` RCP ` Upload Progress: 570681 131072
` RCP ` Upload Progress: 570681 131072
` RCP ` Upload Progress: 570681 196608
` RCP ` Upload Progress: 570681 196608
` RCP ` Upload Progress: 570681 262144
` RCP ` Upload Progress: 570681 262144
` RCP ` Upload Progress: 570681 327680
` RCP ` Upload Progress: 570681 327680
` RCP ` Upload Progress: 570681 393216
` RCP ` Upload Progress: 570681 393216
` RCP ` Upload Progress: 570681 458752
` RCP ` Upload Progress: 570681 458752
` RCP ` Upload Progress: 570681 524288
` RCP ` Upload Progress: 570681 524288
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
` RCP ` Upload Progress: 570681 570681
HarmonyOS
1天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
zbw_apple

rcp的进度回调利用的是libcurl组件,与参数CURLOPT_XFERINFOFUNCTION行为保持一致。 这是curl组件的原始规格。表示传输还在进行,有可能是在处理一些最后阶段的连接挥手操作。 应用可以按需去重(比如进度条),但是重复次数本身是有统计意义的。

分享
微博
QQ
微信
回复
1天前
相关问题
HarmonyOS request文件上传问题
20浏览 • 1回复 待解决
HarmonyOS request.uploadFile 上传文件
172浏览 • 1回复 待解决
HarmonyOS 如何通过SFTP上传文件
122浏览 • 1回复 待解决
HarmonyOS Rcp.post上传图库文件至服务器
550浏览 • 1回复 待解决
request上传返回错误码401
613浏览 • 2回复 待解决