From 30333120bc9ad018b944a00747cc88a2319a9ab4 Mon Sep 17 00:00:00 2001 From: Princesseuh <3019731+Princesseuh@users.noreply.github.com> Date: Fri, 12 Apr 2024 18:56:09 +0200 Subject: [PATCH] fix: pass headers directly --- packages/astro/src/assets/endpoint/generic.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/astro/src/assets/endpoint/generic.ts b/packages/astro/src/assets/endpoint/generic.ts index 337644d14f96..5c51f6575534 100644 --- a/packages/astro/src/assets/endpoint/generic.ts +++ b/packages/astro/src/assets/endpoint/generic.ts @@ -10,10 +10,8 @@ import { imageConfig } from 'astro:assets'; async function loadRemoteImage(src: URL, headers: Headers) { try { const res = await fetch(src, { - headers: { - // Forward all headers from the original request - ...Object.fromEntries(headers.entries()), - }, + // Forward all headers from the original request + headers, }); if (!res.ok) { @@ -47,7 +45,6 @@ export const GET: APIRoute = async ({ request }) => { let inputBuffer: ArrayBuffer | undefined = undefined; const isRemoteImage = isRemotePath(transform.src); - const sourceUrl = isRemoteImage ? new URL(transform.src) : new URL(transform.src, url.origin);