getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.93k stars 509 forks source link

fix(falcon): Don't exhaust request body stream #3768

Closed szokeasaurusrex closed 1 day ago

szokeasaurusrex commented 1 week ago

Only read the cached request._media, since reading request.media will exhaust the request.bounded_stream if it has not been read before. Note that this means that we will now only send the JSON request body to Sentry if the Falcon request handler reads the JSON data.

Fixes #3761

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.87%. Comparing base (3e28853) to head (83334b7). Report is 1 commits behind head on master.

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3768 +/- ## ========================================== - Coverage 79.90% 79.87% -0.04% ========================================== Files 137 137 Lines 15373 15373 Branches 2608 2609 +1 ========================================== - Hits 12284 12279 -5 - Misses 2221 2223 +2 - Partials 868 871 +3 ``` | [Files with missing lines](https://app.codecov.io/gh/getsentry/sentry-python/pull/3768?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [sentry\_sdk/integrations/falcon.py](https://app.codecov.io/gh/getsentry/sentry-python/pull/3768?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Ffalcon.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvZmFsY29uLnB5) | `85.49% <100.00%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry-python/pull/3768/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)