Make reading the request body work in Django ASGI apps.#2495
Merged
Conversation
…try/sentry-python into antonpirker/django_asgi_read_body
antonpirker
marked this pull request as ready for review
November 8, 2023 18:56
Contributor
|
As I was working on the django 5 update I found out that we're not running the asgi django test suite on any version of django 4, because we don't install Basically this is missing from tox.ini: 96a4d46 But when I added it, the asgi test suite was failing for django 4. Maybe also because of the issue you fixed here? We should fix that. Not necessarily in this PR, but it might be that the test case you added was actually never executed for django 4. |
Contributor
|
Created a separate issue for the asgi tests: #2498 @szokeasaurusrex is taking a look. |
sentrivana
approved these changes
Nov 10, 2023
Co-authored by Daniel Szoke <daniel.szoke@sentry.io>
antonpirker
enabled auto-merge (squash)
November 10, 2023 13:54
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.

Handle request body in ASGI based Django apps. Starting with Django 4.1 the stream representing the request body is closed immediately preventing us from reading it. This fix reads the request body early on, so it is cached by Django and can be then read by our integration to add to the events sent to Sentry.
Fixes #2375