utils/exc: Ensure Accept header is honored in django error handlers

Previously the error responses generated by django custom handlers for common HTTP error codes (like 404 for an invalid URL for instance) were always in HTML format and thus the Accept header of HTTP requests were not honored.

This was pretty confusing when querying a Web API endpoint as HTML could be returned when an error occured instead of JSON or YAML.

So generate error response with proper content type based on the Accept HTTP request header value.

Related to #4758 (closed).

Merge request reports