fix: ensures cors headers are run against custom endpoints (#12091)

Restores goal of #10597 and reverts #10718

This is a more surgical way of adding CORS headers to custom endpoints
This commit is contained in:
James Mikrut
2025-04-16 09:15:39 -04:00
committed by GitHub
parent 21599b87f5
commit e79b20363e

View File

@@ -222,8 +222,12 @@ export const handleEndpoints = async ({
}
const response = await handler(req)
return new Response(response.body, {
headers: mergeHeaders(req.responseHeaders ?? new Headers(), response.headers),
headers: headersWithCors({
headers: mergeHeaders(req.responseHeaders ?? new Headers(), response.headers),
req,
}),
status: response.status,
statusText: response.statusText,
})