File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/node/src/integrations/undici Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -308,8 +308,13 @@ function setHeadersOnRequest(
308308 sentryTrace : string ,
309309 sentryBaggageHeader : string | undefined ,
310310) : void {
311- const headerLines = request . headers . split ( '\r\n' ) ;
312- const hasSentryHeaders = headerLines . some ( headerLine => headerLine . startsWith ( 'sentry-trace:' ) ) ;
311+ let hasSentryHeaders : boolean ;
312+ if ( Array . isArray ( request . headers ) ) {
313+ hasSentryHeaders = request . headers . some ( headerLine => headerLine === 'sentry-trace' ) ;
314+ } else {
315+ const headerLines = request . headers . split ( '\r\n' ) ;
316+ hasSentryHeaders = headerLines . some ( headerLine => headerLine . startsWith ( 'sentry-trace:' ) ) ;
317+ }
313318
314319 if ( hasSentryHeaders ) {
315320 return ;
Original file line number Diff line number Diff line change @@ -224,7 +224,9 @@ export interface UndiciRequest {
224224 // Originally was Dispatcher.HttpMethod, but did not want to vendor that in.
225225 method ?: string ;
226226 path : string ;
227- headers : string ;
227+ // string for undici@<=6.6.2 and string[] for undici@>=6.7.0.
228+ // see for more information: https://github.com/getsentry/sentry-javascript/issues/10936
229+ headers : string | string [ ] ;
228230 addHeader ( key : string , value : string ) : RequestWithSentry ;
229231}
230232
You can’t perform that action at this time.
0 commit comments