From 2662dcd69a3dc0c390a1936435590bd679a8188d Mon Sep 17 00:00:00 2001 From: iProdigy <8106344+iProdigy@users.noreply.github.com> Date: Wed, 29 May 2024 00:09:25 -0500 Subject: [PATCH] docs: explain multipart for cloudflare workers (#485) --- docs/json-examples.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/json-examples.md b/docs/json-examples.md index c62be4f7..cb2b46ea 100644 --- a/docs/json-examples.md +++ b/docs/json-examples.md @@ -9,6 +9,7 @@ Thus, any third-party consumer should utilize the body entity named `payload_jso Due to this structure, trying to parse the full `multipart/form-data` as JSON will not succeed until you specifically grab the `payload_json` entity. Competent web frameworks should handle the multipart parsing, so you can easily access the relevant form values. See [here](https://gitea.ivr.fi/Leppunen/runelite-dink-api/src/branch/master/handlers/dinkHandler.js) for an example project that leverages [`@fastify/multipart`](https://github.com/fastify/fastify-multipart) to read the JSON payload and screenshot file. +For Cloudflare Workers, utilize the [`request.formData()`](https://developer.mozilla.org/en-US/docs/Web/API/Request/formData) method. For Express, utilize the [`Multer`](https://github.com/expressjs/multer) middleware. For Golang, utilize the [`ParseMultipartForm`](https://pkg.go.dev/net/http#Request.ParseMultipartForm) function. For http4k, utilize the [`http4k-multipart`](https://www.http4k.org/guide/howto/use_multipart_forms/#lens_typesafe_validating_api_-_reads_all_contents_onto_diskmemory) module.