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 @@ -309,8 +309,13 @@ function setHeadersOnRequest(
309309 sentryTrace : string ,
310310 sentryBaggageHeader : string | undefined ,
311311) : void {
312- const headerLines = request . headers . split ( '\r\n' ) ;
313- const hasSentryHeaders = headerLines . some ( headerLine => headerLine . startsWith ( 'sentry-trace:' ) ) ;
312+ let hasSentryHeaders : boolean ;
313+ if ( Array . isArray ( request . headers ) ) {
314+ hasSentryHeaders = request . headers . some ( headerLine => headerLine === 'sentry-trace' ) ;
315+ } else {
316+ const headerLines = request . headers . split ( '\r\n' ) ;
317+ hasSentryHeaders = headerLines . some ( headerLine => headerLine . startsWith ( 'sentry-trace:' ) ) ;
318+ }
314319
315320 if ( hasSentryHeaders ) {
316321 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