form data with itty-router-openapi

I have a form submission going through a worker built with itty-router-openapi. If I submit the data via a POST request with standard application/json, everything works swimmingly. Use data.body just like the examples, etc. However, if I submit the data as a application/x-www-form-urlencoded, then I get nothing. Moreover, if I try to read FormData() off of the request, then I get "body has already been read." Presumably the body is read during the body sanitization / verification / schema-matching done by itty-router. Any recommendations for which direction to go here? Is there a way to access FormData through itty-router-openapi? https://github.com/cloudflare/itty-router-openapi
GitHub
GitHub - cloudflare/itty-router-openapi: OpenAPI 3 schema generator...
OpenAPI 3 schema generator and validator for Cloudflare Workers - GitHub - cloudflare/itty-router-openapi: OpenAPI 3 schema generator and validator for Cloudflare Workers
1 Reply
cole
coleOP•11mo ago
As a partial workaround, I have removed the "requestBody" section of the schema, which removes the "reading the body" that the framework does. As a result, I get control of deciding which method of parsing the body I want to use. I have decided to base this off of Content-Type in the short term, at least 😄
Want results from more Discord servers?
Add your server