Make 404 more developer-friendly
Right now, if you access and endpoint that doesn't exist, you get 404 without any response body, which is not a very friendly developer experience (with curl in particular as nothing is printed). Let's make 404 return some "No such endpoint" text as the response text to make the experience better.
shouldn't that be user-defined ?
Is there a way to define a root/catch all endpoint? If there is such a way, then users can configure their default response.
@glommer It can be user-defined, but there needs to be some default.
There are some good ideas in https://docs.djangoproject.com/en/4.0/topics/http/middleware/ about having general methods to wrap request/response calls as well as errors. It might be nice to be able to assign these in the policy file, but generally is a good start. Some places might want to log all errors for instance, others may want to log 401s/403s. This also makes the "turn all exceptions into JSON" example from the docs into something that doesn't have to be done once per every endpoint.