From 1c59a7a5c923d264f6b44552a519d9efbd79fc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=90=A5=E7=8F=80?= Date: Mon, 19 Feb 2024 18:32:44 +0800 Subject: [PATCH] =?UTF-8?q?imageKnife=20header=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=E8=81=94=E8=B0=83=E5=9B=BE=E7=89=87=E4=BF=AE=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张琥珀 --- .../src/main/ets/components/imageknife/RequestOption.ets | 6 +++--- .../imageknife/networkmanage/HttpDownloadClient.ets | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/library/src/main/ets/components/imageknife/RequestOption.ets b/library/src/main/ets/components/imageknife/RequestOption.ets index ba572b4..c90482a 100644 --- a/library/src/main/ets/components/imageknife/RequestOption.ets +++ b/library/src/main/ets/components/imageknife/RequestOption.ets @@ -61,14 +61,14 @@ export interface DetachFromLayout{ export class RequestOption { // 遍历添加图片http请求头 - map: Map = new Map(); + headers: Map = new Map(); // RequestOption调用header对于的方法 addHeader(key: string, value: Object) { - this.map.set(key, value); + this.headers.set(key, value); } // 全局调用header对应的方法,包含RequestOption的形式 addHeaderMap(map: Map) { - this.map = map; + this.headers = map; } uuid:string ='' // 唯一标识 diff --git a/library/src/main/ets/components/imageknife/networkmanage/HttpDownloadClient.ets b/library/src/main/ets/components/imageknife/networkmanage/HttpDownloadClient.ets index 8964e91..e4c9a21 100644 --- a/library/src/main/ets/components/imageknife/networkmanage/HttpDownloadClient.ets +++ b/library/src/main/ets/components/imageknife/networkmanage/HttpDownloadClient.ets @@ -60,12 +60,10 @@ export class HttpDownloadClient implements IDataFetch { onComplete(combineArray) }) - console.log('refer' + JSON.stringify(request.map.get('refer'))) const headerObj: Record = {} - request.map.forEach((value, key) => { + request.headers.forEach((value, key) => { headerObj[key] = value }) - console.log('referHeader' + JSON.stringify(headerObj)) httpRequest.requestInStream( request.loadSrc as string, {