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:
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user