Cloudflare DevelopersCD
Cloudflare Developers3y ago
1 reply
cole

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
OpenAPI 3 schema generator and validator for Cloudflare Workers - GitHub - cloudflare/itty-router-openapi: OpenAPI 3 schema generator and validator for Cloudflare Workers
GitHub - cloudflare/itty-router-openapi: OpenAPI 3 schema generator...
Was this page helpful?