GET request using JSON body
context: prisma,zod,typescript
I'm trying to run a
GET
request and passing in a json body, In order to make this work i need to convert it to using .mutation
instead of .query
. I was wondering if this is the standard for using prisma as I know posts will still return data.
for example: in my postman json:
5 Replies
by convenion GET requests aren't supposed to have bodies and some libraries will not support them
I personally use PATCH requests for this anti-pattern since I use PUTs for all updates
Oh cool! does
PATCH
allow you to use .query
then or do you continue using .mutation
? ( i guess i can try it out ) 🙂I don't know for sure, the project I'm using prisma for hasn't needed it
but I don't think your actual problem here is with prisma, but express or whatever you are using
yeah thinking about it.. it looks like its more of a TRPC thing or general HTTP question. I appreciate your for hopping on!
The reason I went this route is if it works with POST but not GET it's probably the api layer
why the original http standard left out bodies on get requests is beyond me, but then again rest api's weren't a thing in the 60's either