sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

XML body in Django (DRF) is not stringified

Open a-martynovich opened this issue 4 years ago • 0 comments

Environment

I'm using sentry.io (SaaS) with

  • sentry-sdk 1.1.0,
  • Django 2.2
  • djangorestframework 3.12.1
  • djangorestframework-xml 2.0.0

Steps to Reproduce

  1. Add a simple endpoint
from rest_framework_xml.parsers import XMLParser

@api_view(["POST"])
@parser_classes((XMLParser,))
def handle_request(request):
    raise Exception("error!")
  1. POST some valid XML to that endpoint, such as
<?xml version="1.0" encoding="UTF-8"?>
<root></root>
  1. Find the exception reported to Sentry on sentry.io

Expected Result

Sentry should show the actual Body of the request (the XML document).

Actual Result

The value of "Body" on Sentry page is "<xml.etree.ElementTree.ElementTree object at 0xSOMEADDRESS>"

a-martynovich avatar May 12 '21 12:05 a-martynovich