Mock form data middleware (
Hello everyone,
I'm using experimental_parseMultipartFormData on some of my procedures and i would like to know if some of you have found a nice way to mock the formData return from the middleware.
I think this can be achieved either by mocking the middleware function with a mocked FormData resolved value (but i dont think thats possible) or by transform formData into a request body that could be correctly parsed by the middleware which use '@web3-storage/multipart-parser'.
Here is my middleware code which is taken from the trpc example (https://github.com/trpc/trpc/blob/66d7db60e59b7c758709175a53765c9db0563dc0/examples/.experimental/next-formdata/src/server/routers/room.ts#L10C1-L23C1):
If someone have managed to do it, it would really help me if you explain how did you do it.
Thanks you 🙂
GitHub
trpc/examples/.experimental/next-formdata/src/server/routers/room.t...
🧙♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
4 Replies