From f8926e5108872daf3b6ad878f42aa368730b270c Mon Sep 17 00:00:00 2001 From: chenai02 <1766431377@qq.com> Date: Wed, 5 Jun 2024 16:33:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BArequest=E5=85=BC=E5=AE=B9Array?= =?UTF-8?q?Buffer=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/apis/interface/NativeRequest.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/taro-platform-harmony-hybrid/src/api/apis/interface/NativeRequest.ts b/packages/taro-platform-harmony-hybrid/src/api/apis/interface/NativeRequest.ts index 64e482b6da21..7b351f479f5b 100644 --- a/packages/taro-platform-harmony-hybrid/src/api/apis/interface/NativeRequest.ts +++ b/packages/taro-platform-harmony-hybrid/src/api/apis/interface/NativeRequest.ts @@ -1,4 +1,5 @@ import Taro from '@tarojs/api' +import { fromByteArray } from 'base64-js' import { ClassInstanceManager } from './ClassInstanceManager' @@ -7,6 +8,10 @@ export class NativeRequest implements Taro.RequestTask { readonly [Symbol.toStringTag]: string = '' private objectId: number constructor (option: any) { + if (option?.data instanceof ArrayBuffer) { + option.bufBase64 = fromByteArray(new Uint8Array(option.data)) + option.data = undefined + } const options = { ...option, success: (res: any) => {