INNER CODE UNIT · TypeScript
duration
yenche123/liubai · liubai-backends/liubai-push-proxy/src/index.ts:48
const duration = Date.now() - start;
console.log(`[Proxy] Response from FCM: ${response.status} ${response.statusText} (${duration}ms)`);
// Create a response with the same status and body
// We need to clone headers to avoid immutable header errors
const newResponse = new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: new Headers(response.headers),
});
// Add CORS if needed (though not strictly necessary for this backend use case)
newResponse.headers.set('Access-Control-Allow-Origin', '*');
return newResponse;
} catch (err: any) {
console.error(`[Proxy] Error: ${err.message || err}`);