Repository navigation
Fix 'No POST data' in ExceptionReporter and AdminEmailHandler for non-form requests (#7953) - #10088
Open
SirFassler wants to merge 2 commits into
Open
SirFassler wants to merge 2 commits into
SirFassler wants to merge 2 commits into
Conversation
…ors (encode#7953) When an uncaught exception occurs during a request with a JSON or non-form payload, Django's ExceptionReporter (and AdminEmailHandler) rendered 'POST: No POST data' because the underlying HttpRequest._post remained empty. - In APIView.raise_uncaught_exception, copy parsed request data and files to the underlying HttpRequest._post and HttpRequest._files before re-raising. - Add regression test asserting ExceptionReporter filtered_POST_items and rendered traceback output.
SirFassler
force-pushed
the
fix-request-post-json-error-report
branch
from
October 27, 2026 03:03
b1e3af4 to
d733a47
Compare
auvipy
self-requested a review
October 28, 2026 07:03
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #7953.
When an unhandled exception occurs in a view processing a request with a JSON or non-form payload, Django's
ExceptionReporterandAdminEmailHandlerrenderedPOST: No POST databecause:Request.POSTreturned an emptyQueryDictfor non-form media types.HttpRequest._postwas restricted to form media types in Fix request formdata handling #5800.request.FILESinExceptionReporter.get_traceback_data()subsequently triggered Django's_load_post_and_files(), setting_postto an emptyQueryDict.Changes
rest_framework/request.py: allowRequest.POSTto return parsed dictionary data when available.rest_framework/views.py: inraise_uncaught_exception(), populate_postand_fileson the underlyingHttpRequestbefore re-raising so Django's exception reporting machinery has access to the payload.TestExceptionReporting.test_uncaught_exception_json_post_data_in_exception_reporterverifying thatfiltered_POST_items, HTML tracebacks, and plain text reports include the parameters rather thanNo POST data.All 1,579 test suite cases pass.