Closed Rama3an closed 7 months ago
Hello,
In fact, you cannot call post directly, (or other view methods such as get, put ...) because, under the hood, your post method become aiohttp_pydantic.view.inject_params.wrapped_handler
.
You should not call post in the on_validation_error
to avoid infinite recursion (if request data is not fixed and post is called again)
However, if you still want do that, try to update the self.request
attribute to fix data, and await post method without parameters, but I'm not sure that you can update an aiohttp request object.
async def on_validation_error(
self, exception: ValidationError, context: str):
self.request = FixedRequestFromWrongRequest(self.request)
return await self.post()
Hello!
I'm in code trying to handle an error that occurs due to invalid input data, and I'm trying to call the POST request again in
on_validation_error
, but I'm getting an error that the POST request is not expecting parametersI'm getting an error