"No POST data" in error report
Author: bblanchonCreated Apr 27, 2021Updated Sep 12, 2026
Checklist
- Raised initially as discussion #7899
- This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
- I have reduced the issue to the simplest possible case.
Description
I'm using Django 3.1.7 & DRF 3.12.2.
When an exception occurs in a ViewSet, Django automatically sends an email to the administrator.
The problem is that the POST data is always empty in this email:
POST: No POST data
Instead, I expect to see the JSON payload that was sent in the request body.
I added a breakpoint in django.utils.log.AdminEmailHandler.emit(), and I can confirm that request.POST is empty.
But on the other hand, I'm sure that request.data was not empty in the ViewSet.
I verified that the request's Content-Type and X-Requested-With are correctly set.
The only non-standard middlewares I use are corsheaders and admin_reorder; I don't think they are related to this problem.
Source: encode/django-rest-framework