Skip to content

Commit 37b78cf

Browse files
Await coroutine and add new annotated value
1 parent 885aeaf commit 37b78cf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

sentry_sdk/_types.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,22 @@ def removed_because_over_size_limit(cls, value=""):
7676
},
7777
)
7878

79+
@classmethod
80+
def removed_because_body_consumed_and_not_cached(cls, value=""):
81+
# type: (Any) -> AnnotatedValue
82+
"""The actual value was removed because the underlying stream has been consumed, without caching the value."""
83+
return AnnotatedValue(
84+
value=value,
85+
metadata={
86+
"rem": [ # Remark
87+
[
88+
"!consumed", # Because the original stream is unavailable
89+
"x", # The fields original value was removed
90+
]
91+
]
92+
},
93+
)
94+
7995
@classmethod
8096
def substituted_because_contains_sensitive_data(cls):
8197
# type: () -> AnnotatedValue

sentry_sdk/integrations/starlette.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ async def extract_request_info(self):
663663
and "sentry_sdk.is_body_cached" in self.request.scope["state"]
664664
and self.request.scope["state"]["sentry_sdk.is_body_cached"]
665665
)
666-
if self.request.is_disconnected() and not is_body_cached:
666+
if await self.request.is_disconnected() and not is_body_cached:
667667
request_info["data"] = (
668668
AnnotatedValue.removed_because_body_consumed_and_not_cached()
669669
)

0 commit comments

Comments
 (0)