You should be able to something like this: ```ts await fetch("https://some.url/", { method: "POST"
You should be able to something like this:
await fetch("https://some.url/", {
method: "POST",
body: formData.get("audio").stream()
});Date.now() or similarawait ai.run('@cf/openai/whisper', input);input need to be?
formdata_parser_supports_fileswrangler.toml file has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.Access-Control-Allow-Origin header?* if you don't care about CORS, and your app doesn't need anything else*router.post("/add", async (res, req) => { return CustomResponse(myJSONPayload, 200) })itty-router ?[sites] attribute in wrangler.toml then yes, they're charged since that uploads them to Workers KV but there's no size limit that way except for the KV per-value limit.hono was amazing than itty for the routing and cors issuectx.waitUntil is for exactly in context of BetterKV?const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*',
'Access-Control-Max-Age': '86400', // optional
'Access-Control-Allow-Headers': 'Content-Type',
};
const CustomResponse = (body: any, status: number = 200) => {
return new Response(body, {
headers: {
...corsHeaders,
'Content-Type': 'application/json',
},
status,
});
};import { Router, createCors, error, json } from 'itty-router'
const { preflight, corsify } = createCors()
const router = Router()
router
// embed preflight upstream to handle all OPTIONS requests
.all('*', preflight)export const router = Router();
const { preflight, corsify } = createCors({
methods: ['GET', 'POST'],
origins: [
// Your origins that are okay here
]
});
router
.all('*', preflight)
.all('*', defaultRoutes.handle)
.all('*', () => error(404));Date.now()await ai.run('@cf/openai/whisper', input);formdata_parser_supports_filesawait ai.run('@cf/openai/whisper', {
audio: [...new Uint8Array(await formData.get("audio").arrayBuffer())],
});