From 53b5d3928144764f477769b3f75a31a9304814e7 Mon Sep 17 00:00:00 2001 From: bangbang93 Date: Fri, 23 Feb 2024 15:22:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E4=BB=8E=E7=BD=91?= =?UTF-8?q?=E7=9B=98=E8=8A=82=E7=82=B9=E5=90=8C=E6=AD=A5=E6=97=B6=E4=BC=9A?= =?UTF-8?q?400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cluster.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cluster.ts b/src/cluster.ts index add83ca..ffd67dd 100644 --- a/src/cluster.ts +++ b/src/cluster.ts @@ -80,7 +80,9 @@ export class Cluster { hooks: { beforeRequest: [ async (options) => { - options.headers.authorization = `Bearer ${await this.tokenManager.getToken()}` + if (options.url.hostname.includes('bmclapi.bangbang93.com')) { + options.headers.authorization = `Bearer ${await this.tokenManager.getToken()}` + } }, ], }, @@ -181,7 +183,10 @@ export class Cluster { hasError = true if (e instanceof HTTPError) { logger.error({err: e}, `下载文件${file.path}失败: ${e.response.statusCode}, url: ${e.response.url}`) - logger.trace({err: e, redirectUrls: e.response.redirectUrls}, e.response.body?.toString()) + logger.trace( + {err: e, options: e.options, redirectUrls: e.response.redirectUrls}, + e.response.body?.toString(), + ) } else { logger.error({err: e}, `下载文件${file.path}失败`) }