how to access body in middleware
Hi, I’m using trpc with nextjs. Does anyone know how to access the request’s body in middleware? As per the Request docs, the body can only be accessed once via
await req.json()
. However, if I do that in the middleware, the body is unusable within the trpc procedure.2 Replies
Why do you need the body? You can manipulate the web request directly, but using an input parser would be the more standard way of getting data from a request. Middlewares can access to the input too if needed
Hello everyone. I'm currently working on a client project that involves using trpc with Next.js. We're using Qstash as our message queue service, and I'm trying to publish a message to updateSubscription procedure. However, Qstash only supports POST requests. So, I created a mutation procedure in the trpc server. My question is, how can I receive the body data in the trpc procedure? I tried using input, but it seems like Qstash can't send the request. Could anyone please guide me on how to tackle this issue?