@trpc/client vanilla client not appending formdata data to the request/payload
server end works fine as i tested it with curl and everything went smoothly but when using @trpc/client package to make vanilla client and then doing a mutation like this
does not work, in request/payload it's just {} an empty object.
my vanilla client looks like this
i added content-type as u can see too but that didn't help at all.
Solution:Jump to solution
okay i figured it out the problem is
httpBatchLink
switching to httpLink
works all fine.5 Replies
I believe tRPC only supports a content-type of "application/json"
why would it not support it when they have docs for formdata and the actual server end parses it on its own?
Sorry I didn't see that before. Not sure if this helps: https://github.com/trpc/trpc/tree/next/examples/minimal-content-types
GitHub
trpc/examples/minimal-content-types at next · trpc/trpc
🧙♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
i've looked at this before and it's using react, i'm using the vanilla client, i'm assuming something's wrong with vanilla one as it's not attaching form data on the client side as the server end is completely working
Solution
okay i figured it out the problem is
httpBatchLink
switching to httpLink
works all fine.