@@ -77,6 +77,7 @@ type Headers = Record<string, string>;
77
77
78
78
type NetworkRequest = {
79
79
performanceEntry : PerformanceEntry ;
80
+ requestMethod : string ;
80
81
requestHeaders ?: Headers ;
81
82
requestBody ?: string | null ;
82
83
responseHeaders ?: Headers ;
@@ -127,6 +128,7 @@ function initPerformanceObserver(
127
128
cb ( {
128
129
requests : initialPerformanceEntries . map ( ( performanceEntry ) => ( {
129
130
performanceEntry,
131
+ requestMethod : 'GET' ,
130
132
} ) ) ,
131
133
isInitial : true ,
132
134
} ) ;
@@ -136,6 +138,7 @@ function initPerformanceObserver(
136
138
cb ( {
137
139
requests : performanceEntries . map ( ( performanceEntry ) => ( {
138
140
performanceEntry,
141
+ requestMethod : 'GET' ,
139
142
} ) ) ,
140
143
} ) ;
141
144
} ) ;
@@ -195,8 +198,8 @@ function initFetchObserver(
195
198
const wrappedFetch : typeof fetch = async function ( url , init ) {
196
199
let performanceEntry : PerformanceResourceTiming | undefined ;
197
200
const networkRequest : Partial < NetworkRequest > = { } ;
201
+ const req = new Request ( url , init ) ;
198
202
try {
199
- const req = new Request ( url , init ) ;
200
203
if ( recordRequestHeaders ) {
201
204
networkRequest . requestHeaders = { } ;
202
205
req . headers . forEach ( ( value , key ) => {
@@ -254,7 +257,15 @@ function initFetchObserver(
254
257
throw cause ;
255
258
} finally {
256
259
if ( performanceEntry ) {
257
- cb ( { requests : [ { performanceEntry, ...networkRequest } ] } ) ;
260
+ cb ( {
261
+ requests : [
262
+ {
263
+ performanceEntry,
264
+ requestMethod : req . method ,
265
+ ...networkRequest ,
266
+ } ,
267
+ ] ,
268
+ } ) ;
258
269
}
259
270
}
260
271
} ;
0 commit comments