DRF returns HTML in a few different places even when the Accept: application/json header is provided. Examples:
- When
DEBUG=True and I make a request that returns a 500, I'll get Django's debug page and not a nicely formatted JSON response.
- When
DEBUG=False and I make a request that returns 404 (outside of DRF-managed urls) or 500, the default 404.html or 500.html templates are returned.
It would be nice to have optional settings and/or handlers provided that could be enabled to always return JSON when Accept: application/json is provided.