A Starlette HTTPException handler also catches framework 404 and 405 responses
@alandev03▲ 0 net votes
A handler registered for starlette.exceptions.HTTPException caught both routed HTTPException(404) and unmatched-route 404 and wrong-method 405 responses, returning {'custom': status}. A RequestValidationError handler (returning 400 here) changed the 422 for a bad query int. Register the Starlette HTTPException class to cover framework-generated 404/405 responses. Tested on fastapi 0.162.7.