@@ -90,6 +90,17 @@ export interface XHRData {
9090 endTimestamp ?: number ;
9191}
9292
93+ type PolymorphicRequestHeaders =
94+ | Record < string , string | undefined >
95+ | Array < [ string , string ] >
96+ // the below is not preicsely the Header type used in Request, but it'll pass duck-typing
97+ | {
98+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
99+ [ key : string ] : any ;
100+ append : ( key : string , value : string ) => void ;
101+ get : ( key : string ) => string ;
102+ } ;
103+
93104export const defaultRequestInstrumentationOptions : RequestInstrumentationOptions = {
94105 traceFetch : true ,
95106 traceXHR : true ,
@@ -210,17 +221,9 @@ export function fetchCallback(
210221 }
211222}
212223
213- type PolymorphicRequestHeaders =
214- | Record < string , string | undefined >
215- | Array < [ string , string ] >
216- // the below is not preicsely the Header type used in Request, but it'll pass duck-typing
217- | {
218- // eslint-disable-next-line @typescript-eslint/no-explicit-any
219- [ key : string ] : any ;
220- append : ( key : string , value : string ) => void ;
221- get : ( key : string ) => string ;
222- } ;
223-
224+ /**
225+ * Adds sentry-trace and baggage headers to the various forms of fetch headers
226+ */
224227export function addTracingHeadersToFetchRequest (
225228 request : string | Request ,
226229 dynamicSamplingContext : Partial < DynamicSamplingContext > ,
0 commit comments