Skip to content

Commit

Permalink
Do not error if post body cannot be read
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-sentry committed May 9, 2024
1 parent 6148f07 commit d42ada4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

from django.core.handlers.wsgi import WSGIRequest
from django.http.response import HttpResponse
from django.http.request import QueryDict
from django.http.request import QueryDict, RawPostDataException
from django.utils.datastructures import MultiValueDict

from sentry_sdk.tracing import Span
Expand Down Expand Up @@ -554,7 +554,10 @@ def parsed_body(self):
try:
return self.request.data
except AttributeError:
return RequestExtractor.parsed_body(self)
try:
return RequestExtractor.parsed_body(self)
except RawPostDataException:
return None # something has already read the POST data


def _set_user_info(request, event):
Expand Down

0 comments on commit d42ada4

Please sign in to comment.