denooak

Cannot upload audio data (audio/mpeg-3 gets rejected)


I'm trying to send a microphone recording from JS (as a Blob in FormData) to Deno/Oak, but I get this error:

BadRequestError - The form contained 
  content type "audio/mpeg-3" 
  which is not supported by the server.

Here is my Oak endpoint:

const body = await context.request.body({ type: 'form-data' })   
// next line triggers the above error
const data = await body.value.read()

My setup is this:

app.use(oakCors())
app.use(router.allowedMethods())
app.use(router.routes())
await app.listen({ port: PORT })

How can I allow Oak to accept "audio/mpeg-3" as a data type?


Solution

  • The issue is probably in the client when declaring mimetype: "audio/mpeg-3" is not valid. Use "audio/mpeg" instead as described in RCF documentation