r/FastAPI • • Sep 04 '24

Question Is the RequestValidationError override documentation out of date or am I dumb?

Trying to make validation errors a bit more human readable, and followed this documentation: https://fastapi.tiangolo.com/tutorial/handling-errors/#override-request-validation-exceptions

I'm using the exact code from their block.

However it still returns json, even using a PlainTextResponse. If I create a RequestValidationError internally and str() it, I do see it formatted correctly, but on a live server it sends back the json version with the msg, loc, input, etc.

Anyone else see this behavior?

1 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/One_Fuel_4147 Sep 04 '24

No, I dont get something like the doc show may be it's outdate or something wrong.
About JSON, all custom JSON response format in all my apps are correct.