diff --git a/functions/api/voice/token.ts b/functions/api/voice/token.ts index 1df1733..49651fe 100644 --- a/functions/api/voice/token.ts +++ b/functions/api/voice/token.ts @@ -4,9 +4,13 @@ interface Env { const handler: ExportedHandler = { async fetch(request, env) { + console.log(env); + console.log(request); + async function gatherResponse(response) { const {headers} = response; const contentType = headers.get("content-type") || ""; + console.log(contentType); if (contentType.includes("application/json")) { return JSON.stringify(await response.json()); } @@ -19,8 +23,10 @@ const handler: ExportedHandler = { headers: {authorization: env.VOICE_TOKEN} }; const response = await fetch('https://api.assemblyai.com/v2/realtime/token', init); + console.log('here'); const results = await gatherResponse(response); - return new Response(results); + console.log(results); + return new Response(results, {headers: "content-type: application/json", status: 200}); } } export default handler;