How to respond with multipart/form-data, containing image and json?
Hi, i'm trying to respond with multipart/form-data format but cant find any working example of how i should do this. https://hono.dev/docs/api/context#body
How can i make working response with, for example, one png file
const imageBuffer = await imageFile.arrayBuffer();
and some other field i.e. "{"json":"somejson"}"
?
I've tried some approaches but they didn't work and insomnia returned errors in attempts to read response.
Context - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
2 Replies
Still cant figure this out
hi @Philipp! have you tried returning a
new Response
?
can you share a snippet with your current implementation, and the errors you're running into?
it doesn't look like you're chunking the response. have you tried adding a content-length
header?
from what you've shared, it's not clear whether the issue is in how bodyContent
or the Response is constructed