@@ -108,10 +108,10 @@ async function _handleFetchBreadcrumb(
108
108
hint : FetchHint ,
109
109
options : ExtendedNetworkBreadcrumbsOptions ,
110
110
) : Promise < void > {
111
- await _parseFetchResponse ( breadcrumb , hint , options ) ;
111
+ const fullBreadcrumb = await _parseFetchResponse ( breadcrumb , hint , options ) ;
112
112
113
113
// Create a replay performance entry from this breadcrumb
114
- const result = _makeNetworkReplayBreadcrumb ( 'resource.fetch' , breadcrumb , hint ) ;
114
+ const result = _makeNetworkReplayBreadcrumb ( 'resource.fetch' , fullBreadcrumb , hint ) ;
115
115
addNetworkBreadcrumb ( options . replay , result ) ;
116
116
}
117
117
@@ -120,9 +120,9 @@ async function _parseFetchResponse(
120
120
breadcrumb : Breadcrumb & { data : FetchBreadcrumbData } ,
121
121
hint : FetchBreadcrumbHint ,
122
122
options : ExtendedNetworkBreadcrumbsOptions ,
123
- ) : Promise < void > {
123
+ ) : Promise < Breadcrumb & { data : FetchBreadcrumbData } > {
124
124
if ( breadcrumb . data . response_body_size || ! hint . response ) {
125
- return ;
125
+ return breadcrumb ;
126
126
}
127
127
128
128
// If no Content-Length header exists, we try to get the size from the response body
@@ -132,11 +132,16 @@ async function _parseFetchResponse(
132
132
const body = await response . text ( ) ;
133
133
134
134
if ( body . length ) {
135
- breadcrumb . data . response_body_size = getBodySize ( body , options . textEncoder ) ;
135
+ return {
136
+ ...breadcrumb ,
137
+ data : { ...breadcrumb . data , response_body_size : getBodySize ( body , options . textEncoder ) } ,
138
+ } ;
136
139
}
137
140
} catch {
138
141
// just ignore if something fails here
139
142
}
143
+
144
+ return breadcrumb ;
140
145
}
141
146
142
147
function _makeNetworkReplayBreadcrumb (
0 commit comments