From 9c728502852aec54039971b3fc63b7079699e9c2 Mon Sep 17 00:00:00 2001 From: Tomas Srnka Date: Wed, 18 Jun 2025 11:03:14 +0200 Subject: [PATCH] Update buildWithProxy.ts - Cast options.headers to OutgoingHttpHeaders to fix Authorization property access - Resolves 4 compilation errors preventing build completion - No functional changes, type safety improvement only --- packages/cli/src/commands/template/buildWithProxy.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/template/buildWithProxy.ts b/packages/cli/src/commands/template/buildWithProxy.ts index 9b57bc382..489348798 100644 --- a/packages/cli/src/commands/template/buildWithProxy.ts +++ b/packages/cli/src/commands/template/buildWithProxy.ts @@ -156,19 +156,22 @@ async function proxy( }, } as http.RequestOptions - if (!options.headers!.Authorization) { + // Type-safe header manipulation + const headers = options.headers as http.OutgoingHttpHeaders + + if (!headers.Authorization) { if (targetUrl.pathname.startsWith('/v2/token')) { - options.headers!.Authorization = `Basic ${credsBase64}` + headers.Authorization = `Basic ${credsBase64}` } else if ( targetUrl.pathname == '/v2/' || targetUrl.pathname == '/v2' ) { - options.headers!.Authorization = `Bearer ${credsBase64}` + headers.Authorization = `Bearer ${credsBase64}` } else if ( // Exclude the artifacts-uploads namespace !targetUrl.pathname.startsWith('/artifacts-uploads/namespaces') ) { - options.headers!.Authorization = `Bearer ${token}` + headers.Authorization = `Bearer ${token}` } }