Accessing request data in guards #3355
-
Hi, I was wondering if and how I can access the query data when from within a guard. The docs on guard only demonstrate how to use the I already found out that I can access access the path parameters (e.g., Is that part of the request processed after the guard? I did try to execute |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
What are you trying to do? I.e., what do you need to achieve by accessing the request body in the guard? |
Beta Was this translation helpful? Give feedback.
Awaiting
receive()
is a bit low level and you'd be dealing with asgi messages if you receive anything at all. Also, if the body has already been accessed (perhaps in middleware, or other guards) then why you'd be left hanging on thereceive()
coroutine.json()
is probably what you want, but if you want the body parsed into a model type then you'd need to use either a dependency or interact with it in the handler.