@@ -108,10 +108,10 @@ async function _handleFetchBreadcrumb(
108108 hint : FetchHint ,
109109 options : ExtendedNetworkBreadcrumbsOptions ,
110110) : Promise < void > {
111- await _parseFetchResponse ( breadcrumb , hint , options ) ;
111+ const fullBreadcrumb = await _parseFetchResponse ( breadcrumb , hint , options ) ;
112112
113113 // Create a replay performance entry from this breadcrumb
114- const result = _makeNetworkReplayBreadcrumb ( 'resource.fetch' , breadcrumb , hint ) ;
114+ const result = _makeNetworkReplayBreadcrumb ( 'resource.fetch' , fullBreadcrumb , hint ) ;
115115 addNetworkBreadcrumb ( options . replay , result ) ;
116116}
117117
@@ -120,9 +120,9 @@ async function _parseFetchResponse(
120120 breadcrumb : Breadcrumb & { data : FetchBreadcrumbData } ,
121121 hint : FetchBreadcrumbHint ,
122122 options : ExtendedNetworkBreadcrumbsOptions ,
123- ) : Promise < void > {
123+ ) : Promise < Breadcrumb & { data : FetchBreadcrumbData } > {
124124 if ( breadcrumb . data . response_body_size || ! hint . response ) {
125- return ;
125+ return breadcrumb ;
126126 }
127127
128128 // If no Content-Length header exists, we try to get the size from the response body
@@ -132,11 +132,16 @@ async function _parseFetchResponse(
132132 const body = await response . text ( ) ;
133133
134134 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+ } ;
136139 }
137140 } catch {
138141 // just ignore if something fails here
139142 }
143+
144+ return breadcrumb ;
140145}
141146
142147function _makeNetworkReplayBreadcrumb (
0 commit comments