Skip to content

Commit

Permalink
fix: pass headers directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh committed Apr 12, 2024
1 parent a0fb992 commit 3033312
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/astro/src/assets/endpoint/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3033312

Please sign in to comment.