#36456 closed Cleanup/optimization (fixed)
Improve content type negotiation for 500 response
| Reported by: | Jake Howard | Owned by: | Johanan Oppong Amoateng |
|---|---|---|---|
| Component: | HTTP handling | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
django.views.debug.technical_500_response supports either a HTML or plain text output. Currently, the client will be served HTML if they support it, even if they preferred a plain text response.
Ideally, the user would be served HTML if it is their preference of the 2, otherwise they'd be served plain text. If for whatever reason neither are supported, serve plain text. This can be done with request.get_preferred_type.
Change History (7)
comment:1 by , 13 months ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 13 months ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:3 by , 13 months ago
| Has patch: | set |
|---|---|
| Needs tests: | set |
comment:4 by , 12 months ago
| Needs tests: | unset |
|---|
comment:5 by , 12 months ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:6 by , 12 months ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:7 by , 17 hours ago
Hi,
What about the existing systems that are already integrated with the current implementation? I think we should provide a backend setting for developers who prefer an HTML response.
In my use case, I rely on the HTML response in Chrome DevTools' Inspect tab for debugging. With the current change, the response is being converted to plain text, which makes debugging more difficult.
Updating the content type across different frontend systems would be time-consuming and could potentially break existing logic, since some of our conditions depend on the request's content type.
In be8c9b19: