René's URL Explorer Experiment


Title: fix(fastapi): Stop eagerly consuming request bodies for streamed spans by alexander-alderman-webb · Pull Request #6286 · getsentry/sentry-python · GitHub

Open Graph Title: fix(fastapi): Stop eagerly consuming request bodies for streamed spans by alexander-alderman-webb · Pull Request #6286 · getsentry/sentry-python

X Title: fix(fastapi): Stop eagerly consuming request bodies for streamed spans by alexander-alderman-webb · Pull Request #6286 · getsentry/sentry-python

Description: Note: Depends on #6287 Description Only attach cached request bodies to streamed spans to avoid relying on an eagerly consumed request body. Use the _json and _form attributes instead of json() and form() accessors to ensure that the request body is not consumed by the SDK. Note: by using _json and _form directly we can no longer distinguish between raw data payloads and payloads that were not cached on the Request object. The attribute is therefore omitted if the request body is not cached, since the endpoint may not have accessed it. The integration can still cause application hangs if middleware or handlers deprive the receive() callable instead of using Starlette accessors. Reliance on the overly ambitious request body access is only eliminated for streamed spans (and only persists for errors with the change). Remove test_request_body_data_does_not_scrub_pii_span_streaming() since test_formdata_request_body() already asserts that fields in the request body are not scrubbed. Remove test_request_body_data_annotated_value_top_level_span_streaming() because the attribute is no longer set if the request body is not JSON or FormData. Issues Reminders Please add tests to validate your changes, and lint your code using tox -e linters. Add GH Issue ID & Linear ID (if applicable) PR title should use conventional commit style (feat:, fix:, ref:, meta:) For external contributors: CONTRIBUTING.md, Sentry SDK development docs, Discord community

Open Graph Description: Note: Depends on #6287 Description Only attach cached request bodies to streamed spans to avoid relying on an eagerly consumed request body. Use the _json and _form attributes instead of json() a...

X Description: Note: Depends on #6287 Description Only attach cached request bodies to streamed spans to avoid relying on an eagerly consumed request body. Use the _json and _form attributes instead of json() a...

Opengraph URL: https://github.com/getsentry/sentry-python/pull/6286

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:eeb78f02-da3c-ee28-9ca8-c7ce5437b087
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC114:16AB79:3899C9:493A22:6B00D29E
html-safe-nonce83d26f9a1b1ad493205d8e1c6773dbdf4eb9f5e7b7031428e59eda2fa9d466c6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTE0OjE2QUI3OTozODk5Qzk6NDkzQTIyOjZCMDBEMjlFIiwidmlzaXRvcl9pZCI6IjgxMzMyMTYyNDEyMTQwODM3NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc531e18e39735e3fbe04f15f353c6b6f75e06e1afadd46ebcd8d66c550b61511
hovercard-subject-tagpull_request:3702742650
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/getsentry/sentry-python/pull/6286/files
twitter:imagehttps://avatars.githubusercontent.com/u/224035503?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224035503?s=400&v=4
og:image:altNote: Depends on #6287 Description Only attach cached request bodies to streamed spans to avoid relying on an eagerly consumed request body. Use the _json and _form attributes instead of json() a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None85bbdfe2b6ba16e234513bc6ceff5d848ef8449820c900692a2b4e67061931e5
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4943239a6d2c591325dad6e5c313e1cafda877f6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/6286/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F6286%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F6286%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/pull/6286/files
Reloadhttps://github.com/getsentry/sentry-python/pull/6286/files
Reloadhttps://github.com/getsentry/sentry-python/pull/6286/files
getsentryhttps://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Codehttps://github.com/getsentry/sentry-python
Issues345 (345)https://github.com/getsentry/sentry-python/issues
Pull requests42 (42)https://github.com/getsentry/sentry-python/pulls
Discussionshttps://github.com/getsentry/sentry-python/discussions
Actionshttps://github.com/getsentry/sentry-python/actions
Security and quality2 (2)https://github.com/getsentry/sentry-python/security
Insightshttps://github.com/getsentry/sentry-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
alexander-alderman-webbhttps://github.com/alexander-alderman-webb
masterhttps://github.com/getsentry/sentry-python/tree/master
webb/fastapi/request-body-asynchttps://github.com/getsentry/sentry-python/tree/webb/fastapi/request-body-async
Conversation 10 https://github.com/getsentry/sentry-python/pull/6286
Commits 31 https://github.com/getsentry/sentry-python/pull/6286/commits
Checks 144 https://github.com/getsentry/sentry-python/pull/6286/checks
Files changed https://github.com/getsentry/sentry-python/pull/6286/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
fix(fastapi): Stop eagerly consuming request bodies for streamed spans https://github.com/getsentry/sentry-python/pull/6286/files#top
Show all changes 31 commits https://github.com/getsentry/sentry-python/pull/6286/files
79e9bf7 test(starlette): Verify request info captured with POST endpoints alexander-alderman-webb May 15, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/79e9bf797289d1ed766bdd16ce4bd9b4910f0fef
1a5d498 fix tests on old starlette versions alexander-alderman-webb May 15, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/1a5d498206851cf9eb98eeddc5e1a6c282edef0c
d91d454 merge master alexander-alderman-webb May 15, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/d91d4549de146ff54875ac44aa37556d4fc564b0
3e9648b fix(starlette): Do not attach eagerly consumed request bodies on stre… alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/3e9648bb87078a9fa0437323524ea248b73eeadb
b92156c update const alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/b92156c3703053c9d1da6721c4ac5076911c922d
f2cedf5 merge alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/f2cedf588c5db6dcc52799600713235a78bb844e
92f1d78 types alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/92f1d788f0a7b106c6a0754d516951230f124126
6a30714 more types alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/6a30714d2ccfa60e9b9094548c06079d81039792
064ed6a defensive access alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/064ed6ad649ff483ce6aee278a647858077378e6
bc8ceb2 patch different form method alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/bc8ceb2846b31f33fc5ad9f3e13f93bd11cb58fa
e8fb24a cleanup alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/e8fb24a510c05980dfa9069e1ad77d22852b7b79
962caa4 merge alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/962caa42a98052982b311a59f712f040e77102a0
b029bc0 skip tests when patched method does not exist alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/b029bc02297e15a190705c278cbf7d227e081d2b
5004aae update docstring alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/5004aae4d2ce2648048358d7e588fcd095e93ab9
83fa16d use cached attributes directly alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/83fa16dc2732e9d7a7dd05be00fe4234901e4a3f
8582cc5 explicit None return alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/8582cc50e7703b8e3a27974e1dfab95cab523d66
2637c8a docstring alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/2637c8a27a42366cfe433664f126d8424de8239e
9d2157e docstring alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/9d2157e165c81f817ad37332c35bc1672e015630
b7787d9 handle null JSON alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/b7787d9e959b280d5daaa3c0ff8181eeb3c8ebd7
cc30819 fix(fastapi): Stop eagerly consuming request bodies for streamed spans alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/cc30819995a4488abbc9bfbe3a5a859a44e78dfe
29fa27c add test photo alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/29fa27c801bee29767a43ecca06f88d663d61af8
324fc68 update import alexander-alderman-webb May 18, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/324fc68e93b3f1a66ae89e4d9e6669676f2c25b1
c937102 fix parameter style alexander-alderman-webb May 19, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/c9371020c63b991189af81df0e087551bf35ce5c
f5ef1a3 test(fastapi): Verify request info captured with POST endpoints alexander-alderman-webb May 19, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/f5ef1a34c1ef799b807b4deeac4b66a5e3fcc873
cd39b28 merge alexander-alderman-webb May 19, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/cd39b283eb7cf9b3ee20878034d44f106b36b8ce
3a2d930 Merge branch 'master' into webb/starlette/request-extractor-tests alexander-alderman-webb Jun 9, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/3a2d93063f9d32839c37960484c749399b661044
4f1578f merge alexander-alderman-webb Jun 9, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/4f1578f2754f2bcd215edb3b2c35a1e3600858e0
a2b096e Merge branch 'webb/starlette/request-body-async' into webb/fastapi/re… alexander-alderman-webb Jun 9, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/a2b096e0a996b46020fec2363769670dfd9067a2
07ab6e0 merge alexander-alderman-webb Jun 9, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/07ab6e0c00bc08979a67d868dd6274e5421db0a0
9097800 use get_current_span alexander-alderman-webb Jun 9, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/9097800c0d7b5b4d59c79ab4369d4d2a881a6fb1
631afbf merge master alexander-alderman-webb Jun 9, 2026 https://github.com/getsentry/sentry-python/pull/6286/commits/631afbfa338378cbf6d1021920fd0dcf80adec3e
Clear filters https://github.com/getsentry/sentry-python/pull/6286/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
fastapi.py https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
starlette.py https://github.com/getsentry/sentry-python/pull/6286/files#diff-6f6cf0fb18998238da86355c38e101792b5fe0582ea0c09c615a68eb82fbea57
test_fastapi.py https://github.com/getsentry/sentry-python/pull/6286/files#diff-9884f1a87d46827d199c87d41b5792f0877fa0d9e9234739ed65bb26826357be
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
sentry_sdk/integrations/fastapi.pyhttps://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
View file https://github.com/getsentry/sentry-python/blob/631afbfa338378cbf6d1021920fd0dcf80adec3e/sentry_sdk/integrations/fastapi.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/6286/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
https://github.com/getsentry/sentry-python/pull/6286/files#diff-d5208951192f0e649cfa9fa86e5f73329c5650961618449f5672154592f64f49
https://github.com/getsentry/sentry-python/blob/master/.github/CODEOWNERS#L1
sentry_sdk/integrations/starlette.pyhttps://github.com/getsentry/sentry-python/pull/6286/files#diff-6f6cf0fb18998238da86355c38e101792b5fe0582ea0c09c615a68eb82fbea57
View file https://github.com/getsentry/sentry-python/blob/631afbfa338378cbf6d1021920fd0dcf80adec3e/sentry_sdk/integrations/starlette.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/getsentry/sentry-python/pull/6286/{{ revealButtonHref }}
https://github.com/getsentry/sentry-python/pull/6286/files#diff-6f6cf0fb18998238da86355c38e101792b5fe0582ea0c09c615a68eb82fbea57
https://github.com/getsentry/sentry-python/pull/6286/files#diff-6f6cf0fb18998238da86355c38e101792b5fe0582ea0c09c615a68eb82fbea57
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6286/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.