Skip to content

Commit f4312a8

Browse files
committed
feat(network-details): Add networkDetailHasUrls to RRWebOptionsEvent
RRWebOptionsEvent payload shows up in the `tags` panel on a session replay. networkDetailHasUrls is required to light-up the UI.
1 parent 38306ef commit f4312a8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Sources/Swift/Integrations/SessionReplay/RRWeb/SentryRRWebOptionsEvent.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,29 @@ final class SentryRRWebOptionsEvent: SentryRRWebCustomEvent {
2626
payload["unmaskedViewClasses"] = options.unmaskedViewClasses.map(String.init(describing:)).joined(separator: ", ")
2727
}
2828

29+
let networkDetailHasUrls = !options.networkDetailAllowUrls.isEmpty
30+
payload["networkDetailHasUrls"] = networkDetailHasUrls
31+
32+
if networkDetailHasUrls {
33+
payload["networkDetailAllowUrls"] = options.networkDetailAllowUrls.map { pattern in
34+
if let regex = pattern as? NSRegularExpression {
35+
return regex.pattern
36+
} else {
37+
return String(describing: pattern)
38+
}
39+
}
40+
payload["networkDetailDenyUrls"] = options.networkDetailDenyUrls.map { pattern in
41+
if let regex = pattern as? NSRegularExpression {
42+
return regex.pattern
43+
} else {
44+
return String(describing: pattern)
45+
}
46+
}
47+
payload["networkCaptureBodies"] = options.networkCaptureBodies
48+
payload["networkRequestHeaders"] = options.networkRequestHeaders
49+
payload["networkResponseHeaders"] = options.networkResponseHeaders
50+
}
51+
2952
super.init(timestamp: timestamp, tag: "options", payload: payload)
3053
}
3154
}

0 commit comments

Comments
 (0)