From 321e11943b66eac8cba81124e494d6228084a078 Mon Sep 17 00:00:00 2001 From: Tony Date: Sat, 1 Jun 2024 19:54:00 +0800 Subject: [PATCH] fix: fix error proxy header. --- app/core/service/ProxyCacheService.ts | 3 ++- .../package/DownloadPackageVersionTarController.test.ts | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/core/service/ProxyCacheService.ts b/app/core/service/ProxyCacheService.ts index aa9f05910..f12a82c16 100644 --- a/app/core/service/ProxyCacheService.ts +++ b/app/core/service/ProxyCacheService.ts @@ -224,7 +224,8 @@ export class ProxyCacheService extends AbstractService { compressed: true, ...options, headers: { - ...ctx.headers, + accept: ctx.header?.accept, + 'user-agent': ctx.header?.['user-agent'], authorization, 'x-forwarded-for': ctx?.ip, via: `1.1, ${this.config.cnpmcore.registry}`, diff --git a/test/port/controller/package/DownloadPackageVersionTarController.test.ts b/test/port/controller/package/DownloadPackageVersionTarController.test.ts index 604650086..8ed3fae9e 100644 --- a/test/port/controller/package/DownloadPackageVersionTarController.test.ts +++ b/test/port/controller/package/DownloadPackageVersionTarController.test.ts @@ -306,7 +306,6 @@ describe('test/port/controller/package/DownloadPackageVersionTarController.test. .get('/foobar/-/foobar-1.0.0.tgz') .set('user-agent', publisher.ua + ' node/16.0.0') .set('Accept', 'application/vnd.npm.install-v1+json'); - console.log(res.status); assert(res.status === 200); // run in background await setTimeout(1000);