Skip to content

Commit

Permalink
follow the existing example
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrivana committed Sep 20, 2024
1 parent f09e071 commit 217382a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 7 additions & 1 deletion sentry_sdk/integrations/_wsgi_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ def json(self):
if not self.is_json():
return None

raw_data = self.raw_data()
try:
raw_data = self.raw_data()
except (RawPostDataException, ValueError):
# The body might have already been read, in which case this will
# fail
raw_data = None

if raw_data is None:
return None

Expand Down
8 changes: 1 addition & 7 deletions sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from django.conf import settings as django_settings
from django.core import signals
from django.conf import settings
from django.http.request import RawPostDataException

try:
from django.urls import resolve
Expand Down Expand Up @@ -552,12 +551,7 @@ def cookies(self):

def raw_data(self):
# type: () -> Optional[bytes]
try:
return self.request.body
except RawPostDataException:
# We can't access the body anymore because the stream has already
# been read
return None
return self.request.body

def form(self):
# type: () -> QueryDict
Expand Down

0 comments on commit 217382a

Please sign in to comment.