Skip to content

Commit c44f1f2

Browse files
ref(starlette): Remove unused _serialize_request_body_data helper (#8146)
Removes `_serialize_request_body_data` from `sentry_sdk/integrations/starlette.py`. Nothing calls it. It was added in #6136 to serialize the request body for the segment span under span streaming. #6286 changed the FastAPI path to serialize the cached `request._json` / `request._form` directly and removed the only call site (`_serialize_request_body_data(info["data"])`). The definition stayed behind. Why it's safe: - The underscore-prefixed name doesn't appear anywhere else in the repo: no references in `sentry_sdk/`, `tests/`, `scripts/`, or docs. - None of the open PRs use it. - The module still uses the `json` and `AnnotatedValue` imports elsewhere, so this change doesn't remove any imports. - Users see no change in behavior or public API. <!-- junior-request-attribution:start --> via [automation `sched_65eed06cc199036c2b13411096f412d4`](https://junior-prod.sentry.dev/automations/sched_65eed06cc199036c2b13411096f412d4) · Run ID `sched_65eed06cc199036c2b13411096f412d4:1793267486380`. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent-dispatch%3Adispatch_d52fabcfb189e56dc472324ad6411165 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_d52fabcfb189e56dc472324ad6411165) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_d52fabcfb189e56dc472324ad6411165/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
1 parent 63707d7 commit c44f1f2

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

‎sentry_sdk/integrations/starlette.py‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,6 @@ async def _sentry_send(*args: "Any", **kwargs: "Any") -> "Any":
277277
return middleware_class
278278

279279

280-
def _serialize_request_body_data(data: "Any") -> str:
281-
# data may be a JSON-serializable value, an AnnotatedValue, or a dict with AnnotatedValue values
282-
def _default(value: "Any") -> "Any":
283-
if isinstance(value, AnnotatedValue):
284-
return value.value
285-
return str(value)
286-
287-
return json.dumps(data, default=_default)
288-
289-
290280
@ensure_integration_enabled(StarletteIntegration)
291281
def _capture_exception(exception: BaseException, handled: "Any" = False) -> None:
292282
event, hint = event_from_exception(

0 commit comments

Comments
 (0)