mirror of
https://github.com/d0zingcat/BroadcastChannel.git
synced 2026-05-14 07:26:50 +00:00
feat: enhance response handling for fetch requests
Improve reliability by ensuring fetch responses are properly wrapped in a new Response object, preserving headers and status codes.
This commit is contained in:
@@ -16,7 +16,8 @@ export async function GET({ request, params, url }) {
|
||||
if (!targetWhitelist.some(domain => target.hostname.endsWith(domain))) {
|
||||
return Response.redirect(target.toString(), 302)
|
||||
}
|
||||
return fetch(target.toString(), request)
|
||||
const response = await fetch(target.toString(), request)
|
||||
return new Response(response.body, response)
|
||||
}
|
||||
catch (error) {
|
||||
return new Response(error.message, { status: 500 })
|
||||
|
||||
Reference in New Issue
Block a user