feat(network-details): Introduce data classes for extracting network details to session replay#7582
feat(network-details): Introduce data classes for extracting network details to session replay#758243jay wants to merge 3 commits intomobile-935/ios-swift-appfrom
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## mobile-935/ios-swift-app #7582 +/- ##
============================================================
Coverage ? 84.985%
============================================================
Files ? 486
Lines ? 28906
Branches ? 12577
============================================================
Hits ? 24566
Misses ? 4293
Partials ? 47
Continue to review full report in Codecov by Sentry.
|
71fd40b to
78d1d60
Compare
0898913 to
240ba73
Compare
78d1d60 to
9a4f8b3
Compare
9a4f8b3 to
c62d15c
Compare
c62d15c to
e717c1a
Compare
Sources/Swift/Integrations/SessionReplay/SentryReplayNetworkDetails.swift
Show resolved
Hide resolved
e717c1a to
2d31c8d
Compare
cd8e4f0 to
327fd2e
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Empty headers always serialized unlike empty warnings
- Updated
Detail.serialize()to only includeheaderswhen the dictionary is non-empty, matching the existing empty-collection serialization behavior.
- Updated
Or push these changes by commenting:
@cursor push aa8c3f54db
Preview (aa8c3f54db)
diff --git a/Sources/Swift/Integrations/SessionReplay/SentryReplayNetworkDetails.swift b/Sources/Swift/Integrations/SessionReplay/SentryReplayNetworkDetails.swift
--- a/Sources/Swift/Integrations/SessionReplay/SentryReplayNetworkDetails.swift
+++ b/Sources/Swift/Integrations/SessionReplay/SentryReplayNetworkDetails.swift
@@ -71,7 +71,9 @@
var result = [String: Any]()
if let size { result["size"] = size }
if let body { result["body"] = body.serialize() }
- result["headers"] = headers
+ if !headers.isEmpty {
+ result["headers"] = headers
+ }
return result
}
}
Sources/Swift/Integrations/SessionReplay/SentryReplayNetworkDetails.swift
Outdated
Show resolved
Hide resolved
327fd2e to
faac0a4
Compare
72a427a to
56c7a59
Compare
Sentry Build Distribution
|
56c7a59 to
a41d68f
Compare
8a5da47 to
719553e
Compare
Sentry Build Distribution
|
Add SentryReplayNetworkDetails — a single Swift class that encapsulates network request/response data for session replay breadcrumbs. Exposes minimal @objc surface (init, setRequest, setResponse) for ObjC callers (SentryNetworkTracker), with idiomatic Swift internals: nested Body, Detail, and BodyContent types, plus a NetworkBodyWarning enum.
a41d68f to
41f8885
Compare
719553e to
1865d4a
Compare

📜 Description
Class diagram
Expected usage
💡 Motivation and Context
See corresponding class definitions in sentry-java
This PR only defines the data contract used by PRs higher in the stack.
See first PR for more motivation/context.
💚 How did you test it?
Unit tests are in the next PR in the stack, which introduces the body parsing and header extraction logic that operates on these types.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled. requires opt-in via specifying networkDetailAllowUrlsCloses #7623