Opened 8 years ago

Closed 5 years ago

Last modified 5 years ago

#27785 closed New feature (duplicate)

Log request.body (or part of it) in the 500 debug content

Reported by: Claude Paroz Owned by:
Component: Error reporting Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a use case where a server error happens due to some unexpected content coming from the request.body content. Unfortunately, the debug view currently doesn't output anything related to request.body. It should probably be trimmed at some point (4Ko for example), and the ability to filter the output could be added with a new method of ExceptionReporterFilter. If undecodable, a simple output like <Undecodable bytes> could be output.

Change History (4)

comment:1 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

I wonder if django rest framework does anything related that could be worth borrowing from.

comment:2 by Carlton Gibson, 5 years ago

Resolution: duplicate
Status: newclosed

#30752 (Django 3.1) allows providing a custom ExceptionReporter sublcass. That will be the place to add the logic you need.

Maybe we could pull something in to do it by default if you come up with a good solution now that it's customizable, but we have X tickets for Can we add A, or B, or C — so my bias is towards leaving the default as we have it now, rather than trying to accommodate every possible extension.

comment:3 by Claude Paroz, 5 years ago

I still think that Django could do better by default here, but fair, let's keep it closed until I (or someone else) come with some possible patch.

comment:4 by Carlton Gibson, 5 years ago

Agreed. Alwasy happy to look at these things if there’s a patch in play. :)

Note: See TracTickets for help on using tickets.
Back to Top